There are $m \times m$ cells on a grid, the top-left cell is at $(1,1)$ while the bottom-right cell is at $(m,m)$. Initially, all the cells were colored white. Little Q has drawn $n$ black $w\times h$ rectangles on the grid. For the $i$-th rectangle, Little Q chose a cell at $(a_i,b_i)$, and painted all the cells $(x,y)$ black, where $a_i\leq x\leq a_i+w-1$ and $b_i\leq y\leq b_i+h-1$.
After Little Q finished all of his work, he is now wondering how many pairs of white cells are 4-connected. Please write a program to calculate:
$$\sum_{(i,j)|1\leq i,j\leq m,\ (i,j)\ is\ white}f(i,j)$$Here $f(i,j)$ is the number of white cells that are 4-connected with $(i,j)$, including $(i,j)$ itself.
Two cells are considered adjacent if and only if they share a common side. Two white cells $(i,j)$, $(x,y)$ are considered 4-connected if and only if there exists a sequence of white cells $c_1,c_2,\dots,c_k$ such that:
- $c_1=(i,j)$.
- $c_k=(x,y)$.
- $c_i$ and $c_{i+1}$ are adjacent for all $i$ ($1\leq i < k$).