Mokia

No attempts yetTime limit1sMemory limit128 MB

Problem

The Moldovan mobile phone company Mokia has built a new customer location system. Like other location systems it answers a query of the form "Where is customer C?" with millimeter precision, and it also answers a query of the form "How many customers are inside a given rectangular area?".

The system treats the world as a square of size W×WW \times W that is divided into cells of size 1×11 \times 1. A cell is named by a pair of indices (x,y)(x, y) with 1x,yW1 \le x, y \le W. Indexing starts at 1, so a table of size 4×44 \times 4 has 1x41 \le x \le 4 and 1y41 \le y \le 4.

Write a program that reports how many customers are inside a given rectangular area.

Input

Each instruction is on its own line and consists of one instruction integer followed by its parameters.

InstructionParametersMeaning
0WCreate a table of size W×WW \times W whose cells are all 0. This instruction is given once, as the first instruction.
1x y AAdd AA to the number of customers in cell (x,y)(x, y). AA is a positive integer.
2X1 Y1 X2 Y2Ask for the total number of customers in the cells (x,y)(x, y) with X1xX2X_1 \le x \le X_2 and Y1yY2Y_1 \le y \le Y_2.
3noneStop the program. This instruction is given once, as the last instruction.

A query counts only the add instructions that come before it in the input. Print nothing for a line whose instruction is not 2.

Output

For every instruction 2, print the requested number of customers on its own line, in the order the queries are given.

Constraints

  • 1W20000001 \le W \le 2\,000\,000
  • 1X1X2W1 \le X_1 \le X_2 \le W
  • 1Y1Y2W1 \le Y_1 \le Y_2 \le W
  • 1x,yW1 \le x, y \le W
  • 0<A100000 < A \le 10\,000
  • The number of instruction 1 lines is at most 160,000.
  • The number of instruction 2 lines is at most 10,000.