#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define gc getchar()
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define N 300010
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int las[N],stc[2][N],bel[N],hv[2][N],y[N],fiv[5],tp[5],up[5],xp[N<<1],ps[N];
struct P{ int x,y;inline bool operator<(const P &p)const{return x<p.x;} }p[N];
inline int gabs(int x) { return x<0?-x:x; }
struct segment{
	int v,pt,l,r;segment *ch[2];
}*rt;
inline int push_up(segment* &rt) { return rt->v=max(rt->ch[0]->v,rt->ch[1]->v); }
int build(segment* &rt,int l,int r)
{
	rt=new segment,rt->l=l,rt->r=r,rt->pt=0;
	if(l==r) return rt->v=-xp[l];int mid=(l+r)>>1;
	return build(rt->ch[0],l,mid),build(rt->ch[1],mid+1,r),push_up(rt);
}
inline int update_tags(segment* &rt,int v) { return rt->v+=v,rt->pt+=v; }
inline int push_down(segment* &rt) { rep(i,0,1) update_tags(rt->ch[i],rt->pt);return rt->pt=0; }
int update(segment* &rt,int s,int t,int v)
{
	if(s>t) return 0;
	int l=rt->l,r=rt->r,mid=(l+r)>>1;
//	if(l==1&&r==) debug(s)sp,debug(t)sp,debug(v)ln;
	if(s<=l&&r<=t) return update_tags(rt,v);
	if(rt->pt) push_down(rt);
	if(s<=mid) update(rt->ch[0],s,t,v);
	if(mid<t) update(rt->ch[1],s,t,v);
	return push_up(rt);
}
int query(segment* &rt,int s,int t)
{
	if(s>t) return 0;
	int l=rt->l,r=rt->r,mid=(l+r)>>1;
	if(s<=l&&r<=t) return rt->v;
	if(rt->pt) push_down(rt);int ans=0;
	if(s<=mid) ans=max(ans,query(rt->ch[0],s,t));
	if(mid<t) ans=max(ans,query(rt->ch[1],s,t));
	return ans;
}
inline int ins(int &t,int *s,int *v,int &up,int p)
{
	if(!p||y[p]==up) return 0;
	update(rt,max(1,ps[s[t]]),ps[p]-1,-(up-y[p]));if(!las[p]) return s[t=1]=p,v[1]=y[p];
//	debug(t)sp,debug(s[t])sp,debug(ps[s[t]])sp,debug(v[s[t]])ln;
	while(t&&y[p]<y[s[t]]) update(rt,max(1,ps[s[t-1]]),ps[s[t]]-1,-(v[t]-y[p])),t--;
	if(p) s[++t]=p,v[t]=y[p];return 0;
}
inline int solve(int w,int h,int n)
{
	tp[0]=tp[1]=fiv[0]=fiv[1]=0,hv[0][1]=up[0]=h-h/2,hv[1][1]=up[1]=h/2;int b,ans=0;
	rep(i,1,n) y[i]=gabs(p[i].y-h/2),bel[i]=(p[i].y<h/2),las[i]=fiv[bel[i]],fiv[bel[i]]=i;
	if(p[1].x==0) ps[1]=1,xp[1]=0;else ps[1]=2,xp[1]=p[1].x-1,xp[2]=p[1].x;
	rep(i,2,n) if(p[i].x==p[i-1].x+1) ps[i]=ps[i-1]+1,xp[ps[i]]=p[i].x;
			else ps[i]=ps[i-1]+2,xp[ps[i]-1]=p[i].x-1,xp[ps[i]]=p[i].x;
	build(rt,1,ps[n]),update(rt,1,ps[n],h);
	rep(i,1,n) b=bel[i-1],ins(tp[b],stc[b],hv[b],up[b],i-1),
		ans=max(ans,max(query(rt,1,ps[i]-1),hv[0][1]+hv[1][1])+p[i].x);
//		debug(ans)ln;//,debug(query(rt,1,ps[i]-1))sp,debug(hv[0][1]+hv[1][1])sp,debug(p[i].x)ln;
//	debug("end")ln;
	if(p[n].x<w) b=bel[n],ins(tp[b],stc[b],hv[b],up[b],n);
//	debug(query(rt,1,ps[n]))sp,debug(hv[0][1]+hv[1][1])ln;
	return max(ans,max(query(rt,1,ps[n]),hv[0][1]+hv[1][1])+w);
}
int main()
{
	int w=inn(),h=inn(),n=inn(),ans=max(w,h)+1;
	if(!n) return !printf("%d\n",(w+h)*2);
	rep(i,1,n) p[i].x=inn(),p[i].y=inn();
	sort(p+1,p+n+1),ans=max(ans,solve(w,h,n));
	rep(i,1,n) swap(p[i].x,p[i].y);
	sort(p+1,p+n+1),swap(w,h),ans=max(ans,solve(w,h,n));
	return !printf("%d\n",ans<<1);
}

Measured memory_bytes: 126080