Problem E
Andrew the Ant
Andrew the Ant is fascinated by the behavior of his friends. Thousands of them are marching their paths on and on. They can build highly organized ant-hills. Sometimes, however, they act a little bit stupidly.
Recently, Andrew watched his fellow ants marching on top of
a long piece of wood. He noticed their behavioral pattern is
very simple: Each ant walks slowly forward with a constant
speed of
Your task is to simulate the movement of ants. For simplicity, suppose that the ants have zero size (although the picture could suggest something else).
Input
The input consists of several scenarios, at most
Output
For each scenario, you should print a single line containing
the text “The last ant will fall down in
Sample Input 1 | Sample Output 1 |
---|---|
90000 1 0 R 10 1 0 L 14 5 3 L 6 L 13 L 8 R 1 R |
The last ant will fall down in 90000 seconds - started at 0. The last ant will fall down in 0 seconds - started at 0. The last ant will fall down in 13 seconds - started at 6 and 8. |