"You know? AI is ruling the world!" Well, there seems no wrong with it as well if you change the word "ruling" into "ruining".
Anyway, to make Ramen's program better, he wants to add machine learning technique into his project. He is working on a picture generation project, and the first step of the process is to calculate the sum of some rectangle of a very special matrix.
The matrix itself is easy to describe. Think about the first quadrant of a two-dimensional coordinate system, the value at the point (i,j) is:
For example, here is a part of the matrix:
Then, Ramen needs the sum of some rectangles. We are using (x1,y1)-(x2,y2) to describe a rectangle, means that the lower left corner's coordinate is (x1, y1) while the upper right corner is (x2, y2). For example, under some situation, he needs the sum of the rectangle below:
It's the rectangle (0,0)-(1,1). The sum of it is 3.
Ramen has written a very fast program to calculate the sum of a rectangle. But after downloading the training data set, he realizes that there is a severe problem: in his program, the origin is (0,0), but all of the training data's origin is (1,1). He has no idea how to modify his program to suit the training data, can you help him to do it?