Chestnut – the Green Symbol of Kyiv#4555

Chestnut – the Green Symbol of Kyiv

3 seconds
64 megabytes
Hard

The chestnut tree has long been a green emblem of Kyiv. In spring, its white and pink candle-like blossoms are a sight to behold, and in autumn, its shiny, lacquer-like fruits are a joy to collect.

Every resident of the capital feels it is their duty to know all about the chestnuts growing in the city. Kupilsky Rostyslav, born and raised in Kyiv, is unsure if he knows everything about this symbol of the capital. Therefore, he seeks your assistance.

To test Rostyslav's knowledge of chestnuts, he might be asked to calculate the total liters of water used for watering the chestnuts in a park area defined by the rectangle x_1, y_1, x_2, y_2. Alternatively, he might be informed about the liters of water used for watering each tree within the rectangle x_1, y_1, x_2, y_2.

Assist him in handling this task.

Input

The first line of the input file contains the numbers (1 \le x, y \le 10^3), representing the dimensions of the park in question. The next line contains the number of queries (1 \le n \le 10^5). The following lines describe the queries in the following format:

  • 1 x_1 y_1 x_2 y_2 — Rostyslav is informed about the liters of water used for watering each tree (1 \le x_1 \le x_2 \le x, 1 \le y_1 \le y_2 \le y, -10^4 \le w \le 10^4).

  • 2 x_1 y_1 x_2 y_2 — he is asked to calculate the total amount of water used for watering the chestnuts in the specified rectangle over the entire period (1 \le x_1 \le x_2 \le x, 1 \le y_1 \le y_2 \le y).

Output

For each query of the second type, output the result on a separate line.

Examples

Example 1

Loading
Loading