#include<algorithm>
#include<iostream>
#include<cstdio>
#define pa pair<int,int>
#define MN 300000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}pa s[MN+5];
long long ans=0;
int w,h,n,num,L[MN+5],ql[MN+5],qr[MN+5],sl[MN+5],sr[MN+5],topl,topr,Mx[MN+5],Mn[MN+5];
struct Tree{int l,r,val,mx;}T[MN*4+5];
inline void Mark(int x,int v){T[x].mx+=v;T[x].val+=v;}
inline void pushdown(int x){Mark(x<<1,T[x].val);Mark(x<<1|1,T[x].val);T[x].val=0;} 
void Build(int x,int l,int r)
{
	if(T[x].val=0,(T[x].l=l)==(T[x].r=r)){T[x].mx=w-L[l];return;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r); 
	T[x].mx=max(T[x<<1].mx,T[x<<1|1].mx);
}
void Modify(int x,int l,int r,int v)
{
	if(l>r) return;
	if(T[x].l==l&&T[x].r==r) return Mark(x,v);
	int mid=T[x].l+T[x].r>>1;
	if(T[x].val) pushdown(x); 
	if(r<=mid) Modify(x<<1,l,r,v);
	else if(l>mid) Modify(x<<1|1,l,r,v);
	else Modify(x<<1,l,mid,v),Modify(x<<1|1,mid+1,r,v);
	T[x].mx=max(T[x<<1].mx,T[x<<1|1].mx);
}	
int Query(int x,int l,int r)
{
	if(l>r) return -2e9;
	if(T[x].l==l&&T[x].r==r) return T[x].mx;
	if(T[x].val) pushdown(x);
	int mid=T[x].l+T[x].r>>1;
	if(r<=mid) return Query(x<<1,l,r);
	else if(l>mid) return Query(x<<1|1,l,r);
	else return max(Query(x<<1,l,mid),Query(x<<1|1,mid+1,r));
}
void Solve()
{
	L[num=1]=topr=topl=0;L[++num]=h;
	for(int i=1;i<=n;++i) L[++num]=s[i].second;
	sort(L+1,L+num+1);num=unique(L+1,L+num+1)-L-1;
	Build(1,1,num);
	for(int i=1;i<=num;++i) Mx[i]=w,Mn[i]=0; 
	for(int i=1;i<=n;++i)
	{
		int y=lower_bound(L+1,L+num+1,s[i].second)-L;
		if(s[i].first<=w/2) Mn[y-1]=max(Mn[y-1],s[i].first);
		if(s[i].first>=w/2) Mx[y-1]=min(Mx[y-1],s[i].first); 
	}
	for(int i=2;i<=num;++i)
	{
		ans=max(ans,2LL*Query(1,1,i-1)+2*L[i]);
		Modify(1,i-1,i-1,-w);
		while(topr&&Mx[i-1]<=sr[topr]) 
			Modify(1,qr[topr-1]+1,qr[topr],w/2-sr[topr]),--topr;
		Modify(1,qr[topr]+1,i-1,Mx[i-1]-w/2);qr[++topr]=i-1;sr[topr]=Mx[i-1];
		while(topl&&Mn[i-1]>=sl[topl])
			Modify(1,ql[topl-1]+1,ql[topl],sl[topl]-w/2),--topl;
		Modify(1,ql[topl]+1,i-1,w/2-Mn[i-1]);ql[++topl]=i-1;sl[topl]=Mn[i-1];
	}
}
int main()
{
	w=read();h=read();n=read();ans=max(w,h)*2+2;
	for(int i=1;i<=n;++i) s[i].first=read(),s[i].second=read();
	Solve();
	swap(w,h);
	for(int i=1;i<=n;++i) swap(s[i].first,s[i].second);
	Solve();
	printf("%lld\n",ans);
	return 0;
}

