{"raw_statement":[{"iden":"problem statement","content":"We have a horizontal cylinder. Given $Q$ queries, process them in the given order.  \nEach query is of one of the following two types.\n\n*   `1 x c`: Insert $c$ balls, with a number $x$ written on each of them, to the right end of the cylinder.\n*   `2 c`: Take out the $c$ leftmost balls contained in the cylinder and print the sum of the numbers written on the balls that have been taken out.\n\nWe assume that the balls do never change their order in the cylinder."},{"iden":"constraints","content":"*   $1 \\leq Q \\leq 2\\times 10^5$\n*   $0 \\leq x \\leq 10^9$\n*   $1 \\leq c \\leq 10^9$\n*   Whenever a query of type `2 c` is given, there are $c$ or more balls in the cylinder.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$Q$\n${\\rm query}_1$\n$\\vdots$\n${\\rm query}_Q$\n\nThe $i$\\-th query ${\\rm query}_i$ is in one of the following two formats.\n\n$1$ $x$ $c$\n\n$2$ $c$"},{"iden":"sample input 1","content":"4\n1 2 3\n2 2\n1 3 4\n2 3"},{"iden":"sample output 1","content":"4\n8\n\n*   For the $1$\\-st query, insert $3$ balls, with a number $2$ written on each of them, to the right end of the cylinder.  \n    The cylinder has now balls with numbers $(2,2,2)$ written on them, from left to right.\n*   For the $2$\\-nd query, take out the $2$ leftmost balls contained in the cylinder.  \n    The numbers written on the balls taken out are $2,2$, for a sum of $4$, which should be printed. The cylinder has now a ball with a number $(2)$ written on it, from left to right.\n*   For the $3$\\-rd query, insert $4$ balls, with a number $3$ written on each of them, to the right end of the cylinder.  \n    The cylinder has now balls with numbers $(2,3,3,3,3)$ written on them, from left to right.\n*   For the $4$\\-th query, take out the $3$ leftmost balls contained in the cylinder.  \n    The numbers written on the balls taken out are $2,3,3$, for a sum of $8$, which should be printed. The cylinder has now balls with numbers $(3,3)$ written on them, from left to right."},{"iden":"sample input 2","content":"2\n1 1000000000 1000000000\n2 1000000000"},{"iden":"sample output 2","content":"1000000000000000000"},{"iden":"sample input 3","content":"5\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1"},{"iden":"sample output 3","content":"There may be nothing you should print."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}