#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define fi first
#define se second
#define N 300100

using namespace std;
typedef pair<int,int> Pair;

int w, h, n, ans;
int x[N], y[N], X[N];
Pair dot[N];

int sta[N], stb[N], topa, topb;
int posa[N], posb[N];

struct SegmentTree {
	int n;
	int Max[N << 2];
	int add[N << 2];
	#define ls rt << 1
	#define rs rt << 1 | 1
	#define mid ((l + r) >> 1)

	void init(int x) {
		n = x;
		memset(Max, 0, sizeof Max);
		memset(add, 0, sizeof add);
	}

	void Add(int rt, int val) {
		add[rt] += val;
		Max[rt] += val;
	}

	void pushdown(int rt) {
		if (!add[rt]) return void();
		Add(ls, add[rt]);
		Add(rs, add[rt]);
		add[rt] = 0;
	}

	void Modify(int l, int r, int len) { Modify(1, 0, n, l, r, len); }
	void Modify(int rt, int l, int r, int L, int R, int val) {
		if (L <= l && r <= R) return Add(rt, val);
		pushdown(rt);
		if (mid >= L) Modify(ls, l, mid, L, R, val);
		if (mid < R) Modify(rs, mid + 1, r, L, R, val);
		Max[rt] = max(Max[ls], Max[rs]);
	}

	int query(int rt, int l, int r, int pos) {
		if (l == r) return Max[rt];
		pushdown(rt);
		if (mid >= pos) return query(ls, l, mid, pos);
		else return query(rs, mid + 1, r, pos);
	}

	int query() { return Max[1]; }
	#undef mid
}St;

int ask(int pos) { return St.query(1, 0, n, pos); }

void work() {
	int mid = (h + 1) / 2;
	sort(dot + 1, dot + n + 1);
	for (int i = 1; i <= n; ++i)
		x[i] = dot[i].fi, y[i] = dot[i].se;

	for (int i = 1; i <= n; ++i) X[i] = x[i];
	int tot_X = unique(X + 1, X + n + 1) - X - 1;
	for (int i = 1; i <= n; ++i)
		x[i] = lower_bound(X + 1, X + tot_X + 1, x[i]) - X;

	St.init(tot_X);
	sta[topa = 0] = -inf;
	stb[topb = 0] = -inf;
	X[0] = 1;

	for (int l = 1, r; l <= n; l = r + 1) {
		r = l;
		while (r < n && x[r + 1] == x[r]) ++r;

		int maxd = 1, minu = h;
		for (int i = l; i <= r; ++i) {
			if (y[i] <= mid) maxd = max(maxd, y[i]);
			if (y[i] >= mid) minu = min(minu, y[i]);
		}

		int up = minu - mid, dn = mid - maxd;
		ans = max(ans, (X[x[l]] - X[x[l - 1]] + h - 1) << 1);
		ans = max(ans, (X[x[l]] + St.query()) << 1); // update ans
		St.Modify(posa[topa], x[l] - 1, up + dn - X[posa[topa]]);

		while (sta[topa] >= up) {  // update stack_up
			St.Modify(posa[topa - 1], posa[topa] - 1, up - sta[topa]);
			--topa;
		}
		posa[++topa] = x[l];
		sta[topa] = up;

		while (stb[topb] >= dn) { // update stack_down
			St.Modify(posb[topb - 1], posb[topb] - 1, dn - stb[topb]);
			--topb;
		}
		posb[++topb] = x[l];
		stb[topb] = dn;
	}
}

int main() {
	scanf("%d%d%d", &w, &h, &n), ++w, ++h;
	for (int i = 1; i <= n; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		dot[i] = make_pair(x + 1, y + 1);
	}

	dot[++n] = make_pair(1, 1);
	dot[++n] = make_pair(w, 1);
	dot[++n] = make_pair(1, h);
	dot[++n] = make_pair(w, h);

	work();
	for (int i = 1; i <= n; ++i)
		swap(dot[i].fi, dot[i].se);
	swap(w, h);
	work();

	printf("%d\n", ans);
	return 0;
}
