eolymp
bolt
Try our new interface for solving problems

Cones

\textbf{n} cones are given in the space. No two cones have common points. The bases of the cones lie in one plane, and the cones themselves lie on one side of this plane. You can connect the cone apex with segments, if and only if these segments do not have common points with the cones. \InputFile The first line contains the number \textbf{n} (1 ≤ \textbf{n} ≤ \textbf{300}). Then \textbf{n} rows with four numbers \textbf{x_i}, \textbf{y_i}, \textbf{r_i}, \textbf{h_i} are given --- the coordinates of the base center of the cone, base radius and the height of the cone. All numbers are integers (\textbf{-500} ≤ \textbf{x_i}, \textbf{y_i} ≤ \textbf{500}, \textbf{1} ≤ \textbf{r_i} ≤ \textbf{100}, \textbf{1} ≤ \textbf{h_i} ≤ \textbf{100}). \OutputFile Print one number - the minimal number of segments you can reach the \textbf{n}-th cone, if started from the first.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
0 0 1 2
0 3 1 3
0 6 1 2
Output example #1
2
Author Stanislav Pak
Source Winter School, Kharkov, 2011, Day 1