#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10;
int w,h,n;
int dx[maxn],dy[maxn];
struct point{int x,y;}p[maxn];
int uplim[maxn],dwlim[maxn];
int sor[maxn],top;
int ustk[maxn],ucnt=0;
int dstk[maxn],dcnt=0;
int Max[maxn<<2],tag[maxn<<2];
int Ans=0;
void pushup(int rt){Max[rt]=max(Max[rt<<1],Max[rt<<1|1]);}
void pushdown(int rt)
{
	if(!tag[rt])return;
	Max[rt<<1]+=tag[rt],Max[rt<<1|1]+=tag[rt];
	tag[rt<<1]+=tag[rt],tag[rt<<1|1]+=tag[rt];
	tag[rt]=0;
}
void build(int rt,int l,int r)
{
	tag[rt]=0,Max[rt]=0;
	if(l==r)return;
	int mid=l+r>>1;
	build(rt<<1,l,mid);
	build(rt<<1|1,mid+1,r);
}
void update(int rt,int l,int r,int L,int R,int v)
{
	if(L==0)L++;
	if(L<=l&&r<=R){Max[rt]+=v,tag[rt]+=v;return;}
	int mid=l+r>>1;
	pushdown(rt);
	if(L<=mid)update(rt<<1,l,mid,L,R,v);
	if(R>mid)update(rt<<1|1,mid+1,r,L,R,v);
	pushup(rt);
}
int query(int rt,int l,int r,int L,int R)
{
	if(L<=l&&r<=R)return Max[rt];
	int mid=l+r>>1,ans=0;
	pushdown(rt);
	if(L<=mid)ans=max(ans,query(rt<<1,l,mid,L,R));
	if(R>mid)ans=max(ans,query(rt<<1|1,mid+1,r,L,R));
	return ans;
}
void solve()
{
	top=0;
	for(int i=1;i<=n;i++)p[i].x=dx[i],p[i].y=dy[i],sor[++top]=p[i].y;
	sort(sor+1,sor+1+top);
	top=unique(sor+1,sor+1+top)-sor-1;
	for(int i=1;i<=n;i++)p[i].y=lower_bound(sor+1,sor+1+top,p[i].y)-sor;
	for(int i=1;i<=top;i++)uplim[i]=0,dwlim[i]=w;
	for(int i=1;i<=n;i++)
	{
		if(p[i].x<=w/2)uplim[p[i].y]=max(uplim[p[i].y],p[i].x);
		else dwlim[p[i].y]=min(dwlim[p[i].y],p[i].x);
	}
	ucnt=dcnt=0;
	build(1,1,top);
	for(int i=1;i<=top;i++)
	{
		//cout<<uplim[i]<<' '<<dwlim[i]<<' '<<sor[i]<<endl;
		if(i!=1)
		{
			update(1,1,top,i-1,i-1,w*2-sor[i-1]*2);
			Ans=max(Ans,query(1,1,top,1,i-1)+sor[i]*2);
			//cout<<Ans<<endl;
			update(1,1,top,i-1,i-1,(dwlim[i]-uplim[i])*2-w*2);
		}
		while(uplim[ustk[ucnt]]<uplim[i]&&ucnt>1)update(1,1,top,ustk[ucnt-1],ustk[ucnt]-1,-(uplim[i]-uplim[ustk[ucnt]])*2),ucnt--;
		ustk[++ucnt]=i;
		while(dwlim[dstk[dcnt]]>dwlim[i]&&dcnt>1)update(1,1,top,dstk[dcnt-1],dstk[dcnt]-1,-(dwlim[dstk[dcnt]]-dwlim[i])*2),dcnt--;		
		dstk[++dcnt]=i;
		
	}
}
int main()
{
	scanf("%d%d%d",&w,&h,&n);
	for(int i=1;i<=n;i++)scanf("%d%d",&dx[i],&dy[i]);
	dx[++n]=0,dy[n]=0;
	dx[++n]=w,dy[n]=h;
	solve();
	for(int i=1;i<=n;i++)swap(dx[i],dy[i]);
	swap(w,h);
	solve();
	printf("%d\n",Ans);
}