In a horizontal cylindrical tunnel that is 1 centimeter in diameter there are 1-centimeter-diameter-balls that move to the right or to the left, all at 1 cm/s. Every time that two balls collide, both them change their direction. Balls also change their direction when colliding against an extreme of the tunnel. The collisions are elastic and there is not friction.
Write a program that reads several experiments, and for each one prints the position and the direction of movement of every ball during some seconds.
Input consists of several experiments. The description of each
experiment begins with the length of the tunnel
and the number of steps
.
Follow the number of balls that move to the right and the positions
where they are. Follow the number of balls that move to the left and the
positions where they are. Assume
,
,
that the distance
between two balls is always an even number, that
can only be 0 just before colliding (‘><’ in the
exemple), that in the leftmost position there is never a
‘>’, and that in the rightmost position there is never a
‘<’.
For each experiment, print
lines, the first one with the experiment’s initial situation, and each
one of the rest with the tunnel configuration a second after. Print a
‘>’ for every ball that moves to the right, a
‘<’ for every ball that moves to the left, and a dot for
every empty position. Print an empty line after the output for each
experiment.
Input
24 6 1 15 3 2 7 10 9 5 0 3 1 7 4
Output
.<....<..<....>......... <....<..<......>........ .>..<..<........>....... ..><..<..........>...... .<..><............>..... <..<..>............>.... <..<..<.. .><..<... <..><.... .><..>... <..>..>..