cho.sh
Notes
Loading...

Travel Guide

Time limit

2s

Memory limit

128 MB

Problem

Yoonhwa is a travel guide who leads tourists on a bus. One day, she is guiding NNN tourists.

During a one-hour lunch break, each tourist goes wherever they want. At the end of the break, no tourist has returned to the bus. Yoonhwa starts from the bus, must meet every tourist, tell them to return immediately, and then return to the bus herself.

At time t=0t = 0t=0, the bus is at the origin (0,0)(0, 0)(0,0). Each tourist keeps moving in a straight line from their current position with their own speed and direction. When Yoonhwa meets a tourist, that tourist immediately changes direction and moves straight back to the bus at the same speed.

Find the minimum possible time at which everyone, including Yoonhwa, has arrived back at the bus.

Input

The first line contains the number of tourists NNN (1≤N≤8)(1 \le N \le 8)(1≤N≤8).

The second line contains Yoonhwa's speed as a decimal number.

Each of the next NNN lines contains four decimal numbers xix_ixi​, yiy_iyi​, viv_ivi​, and aia_iai​.

  • (xi,yi)(x_i, y_i)(xi​,yi​) is the position of the iii-th tourist at time t=0t = 0t=0 (−106≤xi,yi≤106)(-10^6 \le x_i, y_i \le 10^6)(−106≤xi​,yi​≤106).
  • viv_ivi​ is that tourist's speed (1≤vi≤100)(1 \le v_i \le 100)(1≤vi​≤100).
  • aia_iai​ is that tourist's movement direction in radians (1≤ai≤2π)(1 \le a_i \le 2\pi)(1≤ai​≤2π), measured counterclockwise from the positive xxx-axis.

Output

Print the minimum time, rounded to the nearest integer.

The answer is guaranteed to be at most 10610^6106.