Pie

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

There are people labelled from to . You have a whole pie and will perform operations. In the operation, you will give of the remaining pie to person .

Find the proportion of pie obtained by each person after all operations are performed.

Input Specification

The first line contains two space-separated integers, and .

The of the following lines contains two space-separated integers, and .

Output Specification

Output lines, where the line contains a single number, representing the proportion of the pie obtained by person .

Your answer will be accepted if every value is within an absolute error of .

Sample Input 1

3 3
3 13
1 90
3 95

Sample Output 1

0.783000
0.000000
0.212650

Explanation for Sample 1

Initially, the remaining pie is .

• In the 1st operation, person got proportion of pie, and the remaining pie is .
• In the 2nd operation, person got proportion of pie, and the remaining pie is .
• In the 3rd operation, person got proportion of pie.

In total, person got , person got , and person got proportion of pie.

Sample Input 2

3 5
2 20
3 50
1 40
2 30
3 20

Sample Output 2

0.160000
0.272000
0.433600