Lake of the Dragon God

The Lake of the Dragon God is one of the most mythical challenges of the contest. A river must be crossed by jumping from rock to rock, but be careful! Some rocks are fake and sink!

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar [(0pt,0pt)(0pt,0pt) ifnextchar [(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r]

There are nn true rocks, all round, with centre (xi,yi)(x_i, y_i) and radius rir_i. The maximum distance that a contestant can jump is dd (measuring it from the border of the rocks). Your task is to compute the minimum number of jumps to go from the first rock to the last one without falling into the water. If it is impossible, state so.

Input

Input consists of several cases. Each case starts with the number of rocks n2n \ge 2 and the jump distance d>0d > 0. Follow nn triples of real numbers xix_i, yiy_i and rir_i, describing each rock.

Output

For each case of the input, print in a line the minimum number of jumps to go from the first of the given rocks to the last one, by making jumps non larger than dd, or “Xof!” if it is impossible.

Observations

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:16:55.734Z

© Jutge.org, 2006–2026.
https://jutge.org