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 i^\text{th} operation, you will give p_i\% of the remaining pie to person a_i.

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

Constraints

1 \le a_i \le N \le 30

1 \le M \le 30

0 \le p_i \le 100

Input Specification

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

The i^\text{th} of the following M lines contains two space-separated integers, a_i and p_i.

Output Specification

Output N lines, where the i^\text{th} 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 10^{-6}.

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 1.0.

  • In the 1st operation, person 3 got 1.0 * 0.13 = 0.13 proportion of pie, and the remaining pie is 1 - 0.13 = 0.87.
  • In the 2nd operation, person 1 got 0.87 * 0.90 = 0.783 proportion of pie, and the remaining pie is 0.87 - 0.783 = 0.087.
  • In the 3rd operation, person 3 got 0.087 * 0.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

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

Sample Output 2

0.160000
0.272000
0.433600

Comments

There are no comments at the moment.