SP12436 THEPOOL - The One-Dimensional Pool Table

Description

A set of N billiard balls are set on a one-dimensional table. The table is 10 $ ^{5} $ meters long, with two pockets at either side. Each ball has zero width and there is no friction so it is moving with a fixed velocity of either left or right and bounces back in a [perfect elastic collision](http://en.wikipedia.org/wiki/Elastic_collision) from other balls it encounter on its way (or drop into one of the pockets). Your job is to keep track of the balls' movements.

Input Format

The first number, N, is the number of balls (

Output Format

You have to output the position (from the left end) of the tracked ball after time T.