{"raw_statement":[{"iden":"problem statement","content":"You are given an $H \\times W$ grid. The square at the top-left corner will be represented by $(0, 0)$, and the square at the bottom-right corner will be represented by $(H-1, W-1)$.\nOf those squares, $N$ squares $(x_1, y_1), (x_2, y_2), ..., (x_N, y_N)$ are painted black, and the other squares are painted white.\nLet the shortest distance between white squares $A$ and $B$ be the minimum number of moves required to reach $B$ from $A$ **visiting only white squares**, where one can travel to an adjacent square sharing a side (up, down, left or right) in one move.\nSince there are $H × W - N$ white squares in total, there are $_{(H×W-N)}C_2$ ways to choose two of the white squares.\nFor each of these $_{(H×W-N)}C_2$ ways, find the shortest distance between the chosen squares, then find the sum of all those distances, modulo $1$ $000$ $000$ $007=10^9+7$."},{"iden":"constraints","content":"*   $1 \\leq H, W \\leq 10^6$\n*   $1 \\leq N \\leq 30$\n*   $0 \\leq x_i \\leq H-1$\n*   $0 \\leq y_i \\leq W-1$\n*   If $i \\neq j$, then either $x_i \\neq x_j$ or $y_i \\neq y_j$.\n*   There is at least one white square.\n*   For every pair of white squares $A$ and $B$, it is possible to reach $B$ from $A$ visiting only white squares."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$H$ $W$\n$N$\n$x_1$ $y_1$\n$x_2$ $y_2$\n$:$\n$x_N$ $y_N$"},{"iden":"sample input 1","content":"2 3\n1\n1 1"},{"iden":"sample output 1","content":"20\n\nWe have the following grid (`.`: a white square, `#`: a black square).\n\n...\n.#.\n\nLet us assign a letter to each white square as follows:\n\nABC\nD#E\n\nThen, we have:\n\n*   dist(A, B) = $1$\n*   dist(A, C) = $2$\n*   dist(A, D) = $1$\n*   dist(A, E) = $3$\n*   dist(B, C) = $1$\n*   dist(B, D) = $2$\n*   dist(B, E) = $2$\n*   dist(C, D) = $3$\n*   dist(C, E) = $1$\n*   dist(D, E) = $4$\n\nwhere dist(A, B) is the shortest distance between A and B. The sum of these distances is $20$."},{"iden":"sample input 2","content":"2 3\n1\n1 2"},{"iden":"sample output 2","content":"16\n\nLet us assign a letter to each white square as follows:\n\nABC\nDE#\n\nThen, we have:\n\n*   dist(A, B) = $1$\n*   dist(A, C) = $2$\n*   dist(A, D) = $1$\n*   dist(A, E) = $2$\n*   dist(B, C) = $1$\n*   dist(B, D) = $2$\n*   dist(B, E) = $1$\n*   dist(C, D) = $3$\n*   dist(C, E) = $2$\n*   dist(D, E) = $1$\n\nThe sum of these distances is $16$."},{"iden":"sample input 3","content":"3 3\n1\n1 1"},{"iden":"sample output 3","content":"64"},{"iden":"sample input 4","content":"4 4\n4\n0 1\n1 1\n2 1\n2 2"},{"iden":"sample output 4","content":"268"},{"iden":"sample input 5","content":"1000000 1000000\n1\n0 0"},{"iden":"sample output 5","content":"333211937"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}