{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv align\u003d\"left\"\u003eVasya likes to play unusual games very much. One of these games is building towers. Unfortunately he is very tired today and instead of building towers himself, he wants his favorite robot to build towers for him. So, this time, Vasya will be laying on his couch sending commands to his robot. \u003cbr\u003eThe process of constructing towers is very easy. Imagine that you have a number of cells in a row. Cells are numbered from 1 to 10^6 and initially are empty. Robot can move to specified cell and put some number of cubes on it. If there are some cubes already on the cell, he will put new cubes on the top of the existing ones. \u003cbr\u003eFor two integers i and j (i \u0026lt;\u003d j) the cubes on cells i..j are called \u0027tower\u0027, if on any cell with number k, i \u0026lt;\u003d k \u0026lt;\u003d j, there is a positive number of cubes, and there are no cubes on cell i-1 (or i is the leftmost cell in the row) and cell j+1 (or j is the rightmost cell in the row). Length of the tower is j-i+1 - the number of columns in it. \u003cbr\u003eWithin each tower the columns can be numbered from 1 to its length from the left to the right, so instead of giving robot a cell number, Vasya can give robot a tower number and column number within the tower. \u003cbr\u003eAs you can guess, your task is to write a robot that will process commands from Vasya. Robot must be able to build towers and respond to simple questions (see below). \u003cbr\u003eHere is the list of available commands: \u003cbr\u003e \u003cbr\u003eActions: \u003cbr\u003e\u003cul\u003e \u003cbr\u003e\u003cli\u003eput \u0026lt;x\u0026gt; \u0026lt;c\u0026gt; - put c cubes on cell x\u003c/li\u003e \u003cbr\u003e\u003cli\u003etput \u0026lt;t\u0026gt; \u0026lt;x\u0026gt; \u0026lt;c\u0026gt; - put c cubes on column x in tower with number t (towers are numbered from left to the right)\u003c/li\u003e \u003cbr\u003e\u003c/ul\u003e \u003cbr\u003e \u003cbr\u003eQuestions: \u003cbr\u003e\u003cul\u003e \u003cbr\u003e\u003cli\u003etowers - print total number of towers built\u003c/li\u003e \u003cbr\u003e\u003cli\u003ecubes \u0026lt;t\u0026gt; - print the number of cubes in the tower t\u003c/li\u003e \u003cbr\u003e\u003cli\u003elength \u0026lt;t\u0026gt; - print the length of the tower t\u003c/li\u003e \u003cbr\u003e\u003cli\u003etcubes \u0026lt;t\u0026gt; \u0026lt;x\u0026gt; - print the number of cubes in column x of the tower t\u003c/li\u003e\u003c/ul\u003e \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eThe first line of input file contains a number of commands N (1 \u0026lt;\u003d N \u0026lt;\u003d 10^6). Each of the following N lines contains a command. \u003cbr\u003eIt\u0027s guaranteed that all input commands are correct (cell number c is always in range 1..10^6, tower t always exists, column x inside tower always exists and its corresponding cell number is also in range 1..10^6). \u003cbr\u003eYou can assume that no cell will have more than 2^31-1 cubes on it. \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eFor the commands that require printing, output exactly one line according to the format of sample output file below. \u003cbr\u003ePlease, do not follow English grammar rules and print \u00271 towers\u0027 instead of \u00271 tower\u0027. The same applies for printing \u00271 cubes\u0027 and \u00271th\u0027, \u00272th\u0027 and \u00273th\u0027. \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eSample test(s)\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003eInput\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cfont face\u003d\"Courier New\"\u003e\u003c/font\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cpre\u003e\u003c/pre\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e22 \u003cbr\u003etowers \u003cbr\u003eput 2 5 \u003cbr\u003eput 1 6 \u003cbr\u003eput 3 6 \u003cbr\u003eput 3 3 \u003cbr\u003etowers \u003cbr\u003elength 1 \u003cbr\u003eput 6 3 \u003cbr\u003eput 5 4 \u003cbr\u003elength 2 \u003cbr\u003etcubes 2 1 \u003cbr\u003etcubes 2 2 \u003cbr\u003etowers \u003cbr\u003ecubes 1 \u003cbr\u003ecubes 2 \u003cbr\u003eput 4 3 \u003cbr\u003etowers \u003cbr\u003ecubes 1 \u003cbr\u003etput 1 6 50 \u003cbr\u003ecubes 1 \u003cbr\u003etcubes 1 6 \u003cbr\u003elength 1 \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003eOutput\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cfont face\u003d\"Courier New\"\u003e\u003c/font\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cpre\u003e\u003c/pre\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e0 towers \u003cbr\u003e1 towers \u003cbr\u003elength of 1th tower is 3 \u003cbr\u003elength of 2th tower is 2 \u003cbr\u003e4 cubes in 1th column of 2th tower \u003cbr\u003e3 cubes in 2th column of 2th tower \u003cbr\u003e2 towers \u003cbr\u003e20 cubes in 1th tower \u003cbr\u003e7 cubes in 2th tower \u003cbr\u003e1 towers \u003cbr\u003e30 cubes in 1th tower \u003cbr\u003e80 cubes in 1th tower \u003cbr\u003e53 cubes in 6th column of 1th tower \u003cbr\u003elength of 1th tower is 6 \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eNote\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eThis problem has huge tests. Some read/write routines work very slow in several compilers (especially, C/C++: try to use getc() putc() functions to avoid IO troubles). \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"right\"\u003e \u003c/div\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"right\"\u003e \u003c/div\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003chr\u003e\u003c/div\u003e\u003ctable align\u003d\"left\" cellspacing\u003d\"7\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003eAuthor:\u003c/td\u003e\u003ctd\u003eRoman V. Alekseenkov \u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eResource:\u003c/td\u003e\u003ctd\u003eSaratov SU Contest: Golden Fall 2004 \u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eDate:\u003c/td\u003e\u003ctd\u003eOctober 2, 2004 \u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003c/div\u003e \u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\r\n\u003c/div\u003e"}}]}