Submit solution

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

Author:
Problem type

There are N people labelled from 1 to N. You have a whole pie and will perform M operations. In the ith operation, you will give pi% of the remaining pie to person ai.

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

Constraints

1aiN30

1M30

0pi100

Input Specification

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

The ith of the following M lines contains two space-separated integers, ai and pi.

Output Specification

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

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

Sample Input 1

Copy
3 3
3 13
1 90
3 95

Sample Output 1

Copy
0.783000
0.000000
0.212650

Explanation for Sample 1

Initially, the remaining pie is 1.0.

  • In the 1st operation, person 3 got 1.00.13=0.13 proportion of pie, and the remaining pie is 10.13=0.87.
  • In the 2nd operation, person 1 got 0.870.90=0.783 proportion of pie, and the remaining pie is 0.870.783=0.087.
  • In the 3rd operation, person 3 got 0.0870.95=0.08265 proportion of pie.

In total, person 1 got 0.783, person 2 got 0, and person 3 got 0.13+0.08265=0.21265 proportion of pie.

Sample Input 2

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

Sample Output 2

Copy
0.160000
0.272000
0.433600

Comments

There are no comments at the moment.