#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;

#define fi first
#define se second
#define mp make_pair

int w, h, n;

class Node
{public:
	int st, ed;
	int mx;
	int laz;
	Node *l, *r;
	
	Node(){}
	Node(int st, int ed, Node *l, Node *r):st(st), ed(ed), l(l), r(r), mx(-10101010), laz(0){}
	
	
	void change(int v)
	{
		laz += v;
		mx += v;
	}
	void down()
	{
		if(laz)
		{
			l->change(laz);
			r->change(laz);
			laz = 0;
		}
	}
	void update()
	{
		mx = max(l->mx, r->mx);
	}
};

Node *build(int st, int ed)
{
	if(st == ed)
		return new Node(st, ed, 0, 0);
	int mid = st + ed;
	mid>>=1;
	Node *l = build(st, mid);
	Node *r = build(mid + 1, ed);
	return new Node(st, ed, l, r);
}

void change(Node *now, int st, int ed, int v)
{
	if(now->st >= st && now->ed <= ed)
	{
		now->mx += v;
		now->laz += v;
		return;
	}
	now->down();
	if(now->l->ed >= st)
		change(now->l, st, ed, v);
	if(now->r->st <= ed)
		change(now->r, st, ed, v);
	now->update();
}

void set(Node *now, int st, int ed, int v)
{
	if(now->st >= st && now->ed <= ed)
	{
		now->mx = v;
		now->laz = 0;
		return;
	}
	now->down();
	if(now->l->ed >= st)
		set(now->l, st, ed, v);
	if(now->r->st <= ed)
		set(now->r, st, ed, v);
	now->update();
}

class Point
{public:
	int x, y;
}a[301010];

bool cmpx(const Point &a, const Point &b)
{
	if(a.y != b.y)
		return a.y < b.y;	
	return a.x < b.x;
}

int ans;
pair<pair<int,int>,int> stk1[301010], stk2[301010];

void solve()
{
	Node *root = build(1, n);
	int t1, t2 = t1 = 0;
	for(int i = 1; i <= n; ++i)
	{
		if(i > 1)
			ans = max(ans, root->mx + a[i].y);
		if(a[i].x <= w>>1)
		{
			int cur = (w>>1) - a[i].x, low = -1;
			while(t1 && stk1[t1].se > cur)
			{
				change(root, stk1[t1].fi.fi, stk1[t1].fi.se, -(stk1[t1].se - cur));
				low = stk1[t1].fi.fi;
				--t1;
			}
			if(low > -1)
			{
				stk1[++t1] = mp(mp(low, i - 1), cur);
			}
		}
		if(a[i].x >= w>>1)
		{
			int cur = a[i].x - (w>>1), low = -1;
			while(t2 && stk2[t2].se > cur)
			{
				change(root, stk2[t2].fi.fi, stk2[t2].fi.se, -(stk2[t2].se - cur));
				low = stk2[t2].fi.fi;
				--t2;
			}
			if(low > -1)
			{
				stk2[++t2] = mp(mp(low, i - 1), cur);
			}
		}
		stk1[++t1] = mp(mp(i, i), w / 2);
		stk2[++t2] = mp(mp(i, i), w - w / 2);
		set(root, i, i, w - a[i].y);
	}
}

int main()
{
	scanf("%d%d%d", &w, &h, &n);
	ans = max(w, h) + 1;
	for(int i = 1; i <= n; ++i)
		scanf("%d%d", &a[i].x, &a[i].y);
	a[++n].x = a[n].y = 0;
	a[++n].x = w;
	a[n].y = 0;
	a[++n].x = 0;
	a[n].y =h;
	a[++n].x = w;
	a[n].y = h;
	sort(a + 1, a + n + 1, cmpx);
	solve();
	for(int i = 1; i <= n; ++i)
		swap(a[i].x, a[i].y);
	sort(a + 1, a + n + 1, cmpx);
	swap(w, h);
	solve();
	printf("%d\n", ans<<1);
	
	return 0;
}
