Problem B
Betting Profit
Every Saturday, Fred the Frog has the habit of watching frog pirates fight for treasure on the EPFF. The EPFF hosts a betting system that allows its viewers to bet on which pirate gang they think will win the fight. If the viewer predicts correctly, they will win some money based on predetermined odds. Fred possesses a hidden talent for always correctly betting on the frog pirate gang. This talent makes him rich, but being a frog, Fred cannot even do basic arithmetic. He has hired you, an expert developer, to help him write a program that can assist him in calculating his net profit.
Inputs
The first line of input contains an integer
Outputs
Display
Sample Input 1 | Sample Output 1 |
---|---|
2 100 150 + 300 300 - |
150 100 |
Sample Input 2 | Sample Output 2 |
---|---|
10 100 1000 + 200 900 - 300 800 + 400 700 - 500 600 + 600 500 - 700 400 + 800 300 - 900 200 + 1000 100 - |
1000 22.22222 2400 57.14286 3000.00000 120 2800 266.66667 1800 1000 |