TAMU Practice 2022-1b (RMRC 2017)

Start

2022-01-12 11:00 AKST

TAMU Practice 2022-1b (RMRC 2017)

End

2022-01-12 14:00 AKST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -134 days 10:29:58

Time elapsed

3:00:00

Time remaining

0:00:00

Problem J
Particle Collision

Particle colliders are difficult to build and experiments are costly to run. Before running any real experiments it is better to do a simulation to test out the ideas first. You are required to write a very simple simulator for this problem.

There are only three particles in this system, and all particles are confined to an infinite plane so that they can be modelled as circles. Their locations are specified only by the $x_ i$ and $y_ i$ coordinates of their centers ($1 \leq i \leq 3$). All three particles have the same radius $r$, and are initially stationary.

We are given a vector $(x_ v, y_ v)$ specifying the direction particle $1$ will move when the experiment starts. When particle $i$ hits particle $j$, particle $j$ will start moving in the direction perpendicular to the tangent at the point of the contact, away from particle $i$. Particle $i$ will cease to exist and be converted to radiation. A moving particle that does not hit another will continue moving indefinitely.

There are a number of possible scenarios your simulator should identify:

  1. particle $1$ hits particle $2$, which in turns hits particle $3$;

  2. particle $1$ hits particle $3$, which in turns hits particle $2$;

  3. particle $1$ hits particle $2$, which moves indefinitely;

  4. particle $1$ hits particle $3$, which moves indefinitely;

  5. particle $1$ moves indefinitely.

Input

The input contains four lines. The first three lines each contains two integers $x_ i$ and $y_ i$ ($|x_ i|,|y_ i| \leq 1000$), describing particles $1$, $2$, and $3$ in this order. The fourth line contains three integers $x_ v$, $y_ v$, and $r$ ($|x_ v|, |y_ v| \leq 1000$, $0 < r \leq 50$).

You may assume that no two particles touch or overlap initially, and that the distance between the centers of particles $2$ and $3$ is greater than $4r$.

Output

Output a single integer giving the number ($1$$5$) identifying the scenarios described above.

Although you should take care of your calculations, it is guaranteed that the outcome would not change if the initial vector $(x_ v,y_ v)$ is rotated by one degree either way.

Sample Input 1 Sample Output 1
0 0
50 45
91 50
42 50 10
1
Sample Input 2 Sample Output 2
0 0
50 50
141 50
41 50 10
3
Sample Input 3 Sample Output 3
0 0
50 50
131 50
100 50 10
4