#include <algorithm>
#include <cassert>
#include <iostream>
#include <tuple>
#include <vector>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = int(n) - 1; (i) >= 0; -- (i))
#define ALL(x) begin(x), end(x)
using namespace std;
template <class T> inline void chmax(T & a, T const & b) { a = max(a, b); }
template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }

struct point_t { int y, x; };
bool compare_x_y(point_t a, point_t b) { return a.x != b.x ? a.x < b.x : a.y < b.y; }
bool compare_y_x(point_t a, point_t b) { return a.y != b.y ? a.y < b.y : a.x < b.x; }

void solve(int h, int w, int n, vector<point_t> & p, int & perimeter) {
    if (2 * h + 2 * w <= perimeter) {
        return;
    }

    // base cases
    if (p.empty()) {
        chmax(perimeter, 2 * h + 2 * w);
        return;
    }
    if (p.size() == 1) {
        chmax(perimeter, 2 * (    p[0].y + w));
        chmax(perimeter, 2 * (h - p[0].y + w));
        chmax(perimeter, 2 * (h +     p[0].x));
        chmax(perimeter, 2 * (h + w - p[0].x));
        return;
    }
    chmax(perimeter, 2 * h + 2);
    chmax(perimeter, 2 * w + 2);

    sort(ALL(p), compare_y_x);
    const int yc = p[n / 2].y;
    sort(ALL(p), compare_x_y);
    const int xc = p[n / 2].x;
    assert (is_sorted(ALL(p), compare_x_y));

    // conquer
    {
        auto cmp = [&](tuple<int, int, int> a, tuple<int, int, int> b) {
            return get<1>(a) == get<1>(b) and get<2>(a) == get<2>(b);
        };

        vector<tuple<int, int, int> > left;
        {
            int ml = upper_bound(ALL(p), xc, [&](int b, point_t a) { return b < a.x; }) - p.begin();
            int yl = 0, yr = h;
            REP_R (i, ml) {
                left.emplace_back(p[i].x, yl, yr);
                if (p[i].y <= yc) chmax(yl, p[i].y);
                if (p[i].y >= yc) chmin(yr, p[i].y);
                if (p[i].y == yc) break;
            }
            if (yl < yr) left.emplace_back(0, yl, yr);
            reverse(ALL(left));
            left.erase(unique(ALL(left), cmp), left.end());
            reverse(ALL(left));
        }

        vector<tuple<int, int, int> > right;
        {
            int mr = lower_bound(ALL(p), xc, [&](point_t a, int b) { return a.x < b; }) - p.begin();
            int yl = 0, yr = h;
            REP3 (i, mr, n) {
                right.emplace_back(p[i].x, yl, yr);
                if (p[i].y <= yc) chmax(yl, p[i].y);
                if (p[i].y >= yc) chmin(yr, p[i].y);
                if (p[i].y == yc) break;
            }
            if (yl < yr) right.emplace_back(w, yl, yr);
            reverse(ALL(right));
            right.erase(unique(ALL(right), cmp), right.end());
            reverse(ALL(right));
        }

        auto get_perimeter = [&](int l, int r) {
            int lx, lyl, lyr; tie(lx, lyl, lyr) = left[l];
            int rx, ryl, ryr; tie(rx, ryl, ryr) = right[r];
            return 2 * (rx - lx) + 2 * (min(lyr, ryr) - max(lyl, ryl));
        };
        int r = 0;
        REP (l, left.size()) {
            while (r + 1 < right.size() and get_perimeter(l, r + 1) >= get_perimeter(l, r)) ++ r;
            chmax(perimeter, get_perimeter(l, r));
        }
    }

    {  // divide
        vector<point_t> upper, lower, right, left;
        REP (i, n) {
            int y = p[i].y;
            int x = p[i].x;
            if (0  < y and y < yc) lower.push_back(p[i]);
            if (yc < y and y < h ) upper.push_back((point_t) { y - yc, x });
            if (0  < x and x < xc) left .push_back(p[i]);
            if (xc < x and x < w ) right.push_back((point_t) { y, x - xc });
        }
        solve(    yc, w, lower.size(), lower, perimeter);
        solve(h - yc, w, upper.size(), upper, perimeter);
        solve(h,     xc, left .size(), left , perimeter);
        solve(h, w - xc, right.size(), right, perimeter);
    }
}

int main() {
    int w, h, n; cin >> w >> h >> n;
    vector<point_t> p(n);
    REP (i, n) cin >> p[i].x >> p[i].y;
    int perimeter = 0;
    solve(h, w, n, p, perimeter);
    cout << perimeter << endl;
    return 0;
}


Measured memory_bytes: 18880