there is a system of n vessels arranged one above the other as shown in the figure below. assume that the vessels are numbered from 1 to n , in the order from the highest to the lowest, the volume of the i -th vessel is a i liters. initial
there is a system of n vessels arranged one above the other as shown in the figure below. assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ailiters.
initially, all the vessels are empty. in some vessels water is poured. all the water that overflows from the i-th vessel goes to the (i + 1)-th one. the liquid that overflows from the n-th vessel spills on the floor.
your task is to simulate pouring water into the vessels. to do this, you will need to handle two types of queries:
add xi liters of water to the pi-th vessel;print the number of liters of water in the ki-th vessel.
when you reply to the second request you can assume that all the water poured up to this point, has already overflown between the vessels.
