#include<bits/stdc++.h>
#define fi first
#define se second

using namespace std;
typedef pair<int,int> pi;
bool cmp(const pi&a,const pi&b){return a.se<b.se||a.se==b.se&&a.fi<b.fi;}

const int N=300005;

int n,w,h,ans;
pi p[N],b[N];

int u1[N],d1[N],x1[N],m1;
int u2[N],d2[N],x2[N],m2;
int qu[N],va[N],ql,qr;

inline void push(int x,int v){while(va[qr]<=v&&ql<=qr)qr--;qu[++qr]=x,va[qr]=v;}
inline void pop(int x){while(qu[ql]<x&&ql<=qr)ql++;}

void solve(int s,int t,int l,int r){
	if(l>r)return;
	if(s>=t){sort(p+l,p+r+1);return;}
	int H=(s+t+1)>>1,mid=l;
	while(p[mid].se<H&&mid<=r)mid++;
	solve(s,H-1,l,mid-1);solve(H,t,mid,r);
	int i=l,j=mid,k=l;
	while(i<mid||j<=r){
		if(i>=mid)b[k++]=p[j++];
		else if(j>r)b[k++]=p[i++];
		else if(p[i]<p[j])b[k++]=p[i++];
		else b[k++]=p[j++];
	}
	for(i=l;i<k;i++)p[i]=b[i];
	int mi=l;
	while(p[mi].fi<=(w>>1)&&mi<=r)mi++;
	int U,D,L,R;
	m1=m2=0;
	U=t,D=s;
	for(i=mi-1;i>=l;i--){
		++m1,u1[m1]=U,d1[m1]=D,x1[m1]=p[i].fi;
		if(p[i].se>=H)U=min(U,p[i].se);else D=max(D,p[i].se);
	}
	++m1,u1[m1]=U,d1[m1]=D,x1[m1]=0;
	U=t,D=s;
	for(i=mi;i<=r;i++){
		++m2,u2[m2]=U,d2[m2]=D,x2[m2]=p[i].fi;
		if(p[i].se>=H)U=min(U,p[i].se);else D=max(D,p[i].se);
	}
	++m2,u2[m2]=U,d2[m2]=D,x2[m2]=w;
	L=R=1,ql=1,qr=0;
	for(i=1;i<=m1;i++){
		while(u1[i]<=u2[R]&&R<=m2)push(R,x2[R]-d2[R]),R++;
		while(d1[i]>d2[L]&&L<=m2)L++;pop(L);
		if(min(L,R)>1)ans=max(ans,x2[min(L,R)-1]-x1[i]+u1[i]-d1[i]);
		if(ql<=qr)ans=max(ans,va[ql]-x1[i]+u1[i]);
	}
	L=R=1,ql=1,qr=0;
	for(i=1;i<=m2;i++){
		while(u2[i]<=u1[R]&&R<=m1)push(R,-x1[R]-d1[R]),R++;
		while(d2[i]>d1[L]&&L<=m1)L++;pop(L);
		if(min(L,R)>1)ans=max(ans,x2[i]-x1[min(L,R)-1]+u2[i]-d2[i]);
		if(ql<=qr)ans=max(ans,va[ql]+x2[i]+u2[i]);
	}
}

void work(){
	sort(p+1,p+n+1,cmp);
	solve(0,h,1,n);
}

int main(){
	scanf("%d%d%d",&w,&h,&n);
	for(int i=1;i<=n;i++)scanf("%d%d",&p[i].fi,&p[i].se);
	for(int i=1;i<=n;i++)swap(p[i].fi,p[i].se);swap(w,h);
	work();
	for(int i=1;i<=n;i++)swap(p[i].fi,p[i].se);swap(w,h);
	work();
	printf("%d\n",ans*2);
	return 0;
}