
Figure F.1: Illustration of Sample Input 2. The $$$i$$$th image visualizes the $$$i$$$th query of type '+'. This is your time to shine! You are tasked with writing a program that simulates the process of pouring champagne into a given fountain. With this program, Bill can now pretend to pour certain amounts of champagne into different levels. If a bowl in some level is already filled up, then the champagne spills over to the first level below it with larger capacity. If the next larger level is also filled, the champagne spills over even further until eventually seeping into the ground, wasting the good champagne. Additionally, Bill also wants to know at some times during the simulation process how much champagne currently is in a certain level.
The input consists of:
For each query of type '?', output the amount of champagne in the requested level in litres.
4 4 1 2 3 4 + 1 6 ? 4 + 1 6 ? 4
0 4
4 8 2 4 3 5 + 1 4 ? 2 + 2 3 ? 4 + 3 4 ? 4 + 2 10 ? 4
2 1 2 5
| Name |
|---|


