SP15914 USUBQSUB - Update Sub-Matrix & Query Sub-Matrix

Description

Updating and querying 1 dimensional arrays is a popular question. How about updating and quering sub-matrices of a matrix? A sub-matrix will be depicted as (a, b), (c, d). This implies that it will include all the cells (x, y) such that a

Input Format

The first line of input contains N, M. The next M lines contain queries in the same forms as stated above. You may assume that x1

Output Format

The answer to all the queries wherein you need to return the sum of elements in the sub-matrix, i.e., all the queries of type 1.