Off the Wall

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

Input

Output

Sample Input

20 15 10 1 12 1 1
10 20 1 2 7 16 2
100 100 2 50 1 50 1
0 0 0 0 0 0 0

Sample Output

2.828
19.698
100.005

Hint

 

Source

2009 Mid-Atlantic Regional Programming Contest