Time limit: 0.25s
Memory limit: 256MB
Input:
Output:
You are given a matrix with rows and columns. Its entries are consecutive starting from left to right, top to bottom like below:
There are operations which modify the matrix in the following way: a submatrix is chosen inside the matrix and it will be inverted horizontally and vertically. For example if the submatrix with the top-left coordinate and bottom-right coordinate is inverted on the one above it will look like this:
You are also given the coordinates of a cell, type the value of that cell after all operations.
Input
The first line will contain integers, and .
The following lines will contain and which describe the top-left, bottom-right coordinates of the submatrix .
For tests worth points it is guaranteed that
Example
stdin
4 5 1 1 3
1 3 3 5
stdout
14