When going to open or close a door on a hinge, many of us will figure out that
it is much easier to move the door when the knob is placed far from the hinge.
If we push on the door close to the hinge, it takes a bit more force to get the
whole door moving. This is an example of the concept of Torque. Whereas
unresitricted objects will experience a linear acceleration under the influence
of a force corresponding to the equation F - m * a, an object restricted to
rotation around an axis (like a door on a hinge) will experience an angular
acceleration under the influence of a force which imparts a torque, calculated
by the equation
$$ \Large \tau = r * F $$
Where τ is the torque, r is the radial distance from the axis of rotation,
and F is the force perpendicular to the axis at the radial distance r. For
an object to remain at rest around a fixed axis, the sum of any torques acting
upon it must be equal to zero.
Are you familiar with the game tug-of-war? Often played by schoolchildren (at least when I was a schoolchild), it involves two teams of many members taking hold of a long rope, and each pulling towards their team's side to overpower the other team's combined strength.
Let's imagine a similar game with a slight variation. Instead of a long rope we will instead have a long board on a hinge (similar to a door, but very wide), and the players of each team will line up on either side of the door and push, attempting to overpower the other team and swing the board towards them.
For each player you will be given their pushing force F as well as their distance
from the hinge r. You will then be given L the total length of the board, and
must calculate F_L being the force required from a person positioned at the end
of the board in order to keep the board remaining at rest.
All forces will be given in units of Newtons, and all lengths in units of meters.
Input Data
You will be given several lines in the format F r corresponding to the pushing
force and position of a player (negative forces indicate players on the opposing
team).
The final line will contain a single value L, being the total length of the
board.
Answer
Should consist of the single value F_L, being the force required of to be applied
to the free end of the board to have it remain at rest under the constant pushing
forces of each described player.
Error should be less than 1e-6
Example
input data:
1 2
3 -4
5 6
7 -8
9
answer:
4