PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#FW0000051. 106 dặm đến Chicago (106 miles to Chicago)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

106 dặm đến Chicago (106 miles to Chicago)

106 miles to Chicago

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Undirected roads have independent safe-travel probabilities in percent. Find the maximum probability of successfully travelling from city 1 to city n.

Input

First n m; then m lines u v probabilityPercent (1-based).

Output

Print the maximum probability, expressed as a percentage with six decimal places followed by percent.

Subtasks

  • Subtask 1 (40 points): 2≤n≤8, 0≤m≤18, 1≤p≤1002\le n\le 8,\ 0\le m\le 18,\ 1\le p\le 100. Vertices are 1-based and each undirected road joins two distinct vertices. Parallel roads are allowed.
  • Subtask 2 (60 points): 2≤n≤100, 0≤m≤600, 1≤p≤1002\le n\le 100,\ 0\le m\le 600,\ 1\le p\le 100. Vertices are 1-based and each undirected road joins two distinct vertices. Parallel roads are allowed.

Examples

Input

3 3
1 2 80
2 3 50
1 3 30

Output

40.000000 percent

Explanation

Roads 1–2–3 yield 0.8 × 0.5 = 0.4, or 40%, while the direct road yields 30%.