{"raw_statement":[{"iden":"problem statement","content":"There is a rectangle in the $xy$\\-plane, with its lower left corner at $(0, 0)$ and its upper right corner at $(W, H)$. Each of its sides is parallel to the $x$\\-axis or $y$\\-axis. Initially, the whole region within the rectangle is painted white.\nSnuke plotted $N$ points into the rectangle. The coordinate of the $i$\\-th ($1 ≦ i ≦ N$) point was $(x_i, y_i)$.\nThen, for each $1 ≦ i ≦ N$, he will paint one of the following four regions black:\n\n*   the region satisfying $x < x_i$ within the rectangle\n*   the region satisfying $x > x_i$ within the rectangle\n*   the region satisfying $y < y_i$ within the rectangle\n*   the region satisfying $y > y_i$ within the rectangle\n\nFind the longest possible perimeter of the white region of a rectangular shape within the rectangle after he finishes painting."},{"iden":"constraints","content":"*   $1 ≦ W, H ≦ 10^8$\n*   $1 ≦ N ≦ 3 \\times 10^5$\n*   $0 ≦ x_i ≦ W$ ($1 ≦ i ≦ N$)\n*   $0 ≦ y_i ≦ H$ ($1 ≦ i ≦ N$)\n*   $W$, $H$ (21:32, added), $x_i$ and $y_i$ are integers.\n*   If $i ≠ j$, then $x_i ≠ x_j$ and $y_i ≠ y_j$."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$W$ $H$ $N$\n$x_1$ $y_1$\n$x_2$ $y_2$\n$:$\n$x_N$ $y_N$"},{"iden":"sample input 1","content":"10 10 4\n1 6\n4 1\n6 9\n9 4"},{"iden":"sample output 1","content":"32\n\nIn this case, the maximum perimeter of $32$ can be obtained by painting the rectangle as follows:\n\n![image](https://atcoder.jp/img/arc063/842bb3939c9721d978d4e122b0bfff55.png)"},{"iden":"sample input 2","content":"5 4 5\n0 0\n1 1\n2 2\n4 3\n5 4"},{"iden":"sample output 2","content":"12"},{"iden":"sample input 3","content":"100 100 8\n19 33\n8 10\n52 18\n94 2\n81 36\n88 95\n67 83\n20 71"},{"iden":"sample output 3","content":"270"},{"iden":"sample input 4","content":"100000000 100000000 1\n3 4"},{"iden":"sample output 4","content":"399999994"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}