#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const int INF = TEN(9);

int solve(V<pii> pts, int lx, int rx, int ly, int ry, int M) {
	//printf("wo size=%d, lx=%d, rx=%d, ly=%d, ry=%d\n", pts.size(), lx, rx, ly, ry);

	if (pts.size() == 0) {
		return (rx - lx + ry - ly);
	}

	if (pts.size() == 1) {
		int res = 0;
		chmax(res, (rx - lx + pts[0].se - ly));
		chmax(res, (rx - lx + ry - pts[0].se));
		chmax(res, pts[0].fi - lx + ry - ly);
		chmax(res, rx - pts[0].fi + ry - ly);
		return res;
	}

	sort(ALL(pts));

	int sz = pts.size();
	V<pii> vec;
	for (auto &p : pts) {
		vec.eb(p.se, p.fi);
	}
	sort(ALL(vec));

	int my = vec[sz / 2].fi - 1;

	V<pii> ptl, ptr;

	rep(i, sz) {
		if (vec[i].fi < my) {
			ptl.eb(vec[i].se, vec[i].fi);
		} else {
			ptr.eb(vec[i].se, vec[i].fi);
		}
	}

	int res = max(solve(ptl, lx, rx, ly, my, M), solve(ptr, lx, rx, my, ry, M));

	V<pair<int, pii>> vl, vr;

	{
		int mini = ly, maxi = ry;
		for (int i = sz - 1; i >= 0; --i) {
			if (pts[i].fi < M) {
				if (mini <= maxi) {
					vl.eb(pts[i].fi, mp(mini, maxi));
				}
				if (pts[i].se > my) {
					chmin(maxi, pts[i].se);
				} else {
					chmax(mini, pts[i].se);
				}
			}
		}
		if (mini <= maxi) {
			vl.eb(lx, mp(mini, maxi));
		}		
	}

	{
		int mini = ly, maxi = ry;
		rep(i, sz) {
			if (pts[i].fi > M) {
				if (mini <= maxi) {
					vr.eb(pts[i].fi, mp(mini, maxi));
				}
				if (pts[i].se > my) {
					chmin(maxi, pts[i].se);
				} else {
					chmax(mini, pts[i].se);
				}
			}
		}
		if (mini <= maxi) {
			vr.eb(rx, mp(mini, maxi));
		}
	}

	auto calc_len = [&](const pair<int, pii>& a, const pair<int, pii>& b) {
		int p = max(a.se.fi, b.se.fi), q = min(a.se.se, b.se.se);
		return (q >= p ? q - p + abs(b.fi - a.fi) : 0);
	};

	{
		int now = 0;

		rep(i, vl.size()) {
			auto p = vl[i];
			while (now + 1 < vr.size()) {
				auto q = vr[now], q2 = vr[now + 1];
				int c = calc_len(p, q);
				int c2 = calc_len(p, q2);
				chmax(res, c);
				chmax(res, c2);
				if (c2 >= c) {
					++now;
				} else {
					break;
				}	
			}
			{
				auto q = vr[now];
				int c = calc_len(p, q);
				chmax(res, c);
			}		
		}
	}

	{
		int now = 0;

		rep(i, vr.size()) {
			auto p = vr[i];
			while (now + 1 < vl.size()) {
				auto q = vl[now], q2 = vl[now + 1];
				int c = calc_len(p, q);
				int c2 = calc_len(p, q2);
				chmax(res, c);
				chmax(res, c2);
				if (c2 >= c) {
					++now;
				} else {
					break;
				}	
			}
			{
				auto q = vl[now];
				int c = calc_len(p, q);
				chmax(res, c);
			}		
		}
	}

	return res;
}

int main() {
	int W, H, N; cin >> W >> H >> N;
	V<pii> pts(N);

	rep(i, N) {
		int x, y;
		cin >> x >> y;
		x *= 2, y *= 2;
		pts[i] = mp(x, y);
	}
	W *= 2, H *= 2;

	int ans = 0;

	rep(t, 2) {
		int M = (t == 0 ? W / 2 : H / 2);
		if (M % 2 == 0) {
			chmax(ans, solve(pts, 0, (t == 0 ? W : H), 0, (t == 0 ? H : W), M-1));
			chmax(ans, solve(pts, 0, (t == 0 ? W : H), 0, (t == 0 ? H : W), M+1));
		} else {
			chmax(ans, solve(pts, 0, (t == 0 ? W : H), 0, (t == 0 ? H : W), M));
		}
		rep(i, N) swap(pts[i].fi, pts[i].se);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 26200