# 55. The Robots

## I'm a slow walker, but I never walk backwards.

Write a program to predict the fate of two robots. Suppose we have two robots running in an $M$ (horizontal) by $N$ (vertical) unit grid. Both will move at the speed of one square per time step. The first robot carries $F1$ amount of fuel and the second robot carries $F2$. If a robot runs out of fuel, it will stop at that square. Moving to a new square requires one unit of fuel. During the first $N1$ time steps the first robot $R1$ will move to the north, then during the next $E1$ time steps it will move towards the east. The first robot will repeat this pattern until it runs out of fuel. The second robot $R2$ will move a little bit differently. During the first $E2$ time steps the second robot $R2$ will move to the east, then during the next $N2$ time steps it will move towards the north. Again the second robot will repeat this pattern until it runs out of fuel. If either robot moves "out of bound", it will "wrap around" and reappear (by sort of magic) on the other side of the field. For example, if $M = 7$ and $N = 6$ and a robot at $(5, 5)$ goes north, it will reappear at $(5, 0)$. In addition, if two robots move into the same square, they explode. Now given the starting position of the first robot at $(X1, Y1)$, and the second robot at $(X2, Y2)$, and the amount of fuel they carry ($F1$ and $F2$), determine whether the two robots will explode or not.

## Input

There are only one line of inputs that contains $M, \; N, \; X1, \; Y1, \; E1, \; N1, \; F1, \; X2, \; Y2, \; E2, \; N2, \; F2$, with the following constraints.

• $0 \lt N, \; M \lt 10000$
• $0 \le X1, \; X2 \lt M$
• $0 \le Y1, \; Y2 \lt N$
• $(X1, Y1) \text{ is not } (X2, Y2)$
• $0 \lt N1, \; E1, \; N2, \; E2$
• $0 \le F1, \; F2 \le 10000$

## Output

There are two cases of output. If two robots will explode, output robots explode at time T, where $T$ is the time step they explode. Otherwise output robots will not explode.

## Sample input

7 6 2 0 9 2 100 3 5 2 7 100


## Sample output

robots explode at time 5


## Sample input

7 6 2 0 9 2 6 3 5 2 7 0


## Sample output

robots will not explode