import math def main(): import sys input = sys.stdin.read data = input().split() index = 0 N = int(data[index]) index += 1 W = int(data[index]) index += 1 sushis = [] for _ in range(N): X = int(data[index]) index +=1 Y = int(data[index]) index +=1 R = int(data[index]) index +=1 V = int(data[index]) index +=1 A = int(data[index]) index +=1 sushis.append( (X, Y, R, V, A) ) INF = float('inf') size = 1 << N dp = [ [INF] * N for _ in range(size) ] # Initialize for single sushi states for j in range(N): Xj, Yj, Rj, Vj, Aj = sushis[j] start_pos = (0.0, 0.0) start_time = 0.0 # Function to compute sushi j's position at time t def j_pos(t): theta = (Vj * t + Aj) * math.pi / 180.0 x = Xj + Rj * math.cos(theta) y = Yj + Rj * math.sin(theta) return (x, y) # Binary search for the minimal t_j where distance from start_pos <= W * t_j low = 0.0 high = 1e18 # Initial upper bound # Initial check at t=0 initial_x, initial_y = j_pos(0.0) dx = initial_x - 0.0 dy = initial_y - 0.0 initial_dist = math.hypot(dx, dy) if initial_dist < 1e-9: dp[1<= current_time # where distance from start_pos to j's position <= W*(t_j - current_time) low = current_time high = current_time + 1e18 # Initial upper bound # Check if starting position already covers it x_initial, y_initial = j_pos(current_time) dx_initial = x_initial - xi dy_initial = y_initial - yi initial_dist = math.hypot(dx_initial, dy_initial) if initial_dist < 1e-9: new_mask = mask | (1 << j) if current_time < dp[new_mask][j]: dp[new_mask][j] = current_time continue # Compute upper bound based on speed considerations S_j = Rj * abs(Vj) * math.pi / 180.0 initial_upper = current_time + initial_dist / (W - S_j + 1e-9) high = initial_upper # Binary search for _ in range(100): mid = (low + high) / 2 x, y = j_pos(mid) dx = x - xi dy = y - yi dist = math.hypot(dx, dy) allowed = W * (mid - current_time) if dist <= allowed + 1e-9: high = mid else: low = mid # After binary search, check high x_high, y_high = j_pos(high) dx = x_high - xi dy = y_high - yi dist_high = math.hypot(dx, dy) allowed = W * (high - current_time) if dist_high <= allowed + 1e-9: new_time = high new_mask = mask | (1 << j) if new_time < dp[new_mask][j]: dp[new_mask][j] = new_time # Find the minimal time for full mask full_mask = (1 << N) - 1 min_time = INF for j in range(N): if dp[full_mask][j] < min_time: min_time = dp[full_mask][j] print("{0:.15f}".format(min_time)) if __name__ == "__main__": main()