#include <bits/stdc++.h>

using namespace std;

using lint = long long;

const int N_ = int(3.1e5);

class SegmentTree{
  const int MAXN = int(3e5);
	lint tree[530000*2], lazy[530000*2];
	void lazydown(int p){
		tree[2*p] += lazy[p];
		tree[2*p+1] += lazy[p];
		lazy[2*p] += lazy[p];
		lazy[2*p+1] += lazy[p];
		lazy[p] = 0;
	}
	void add(int s, int e, int ps, int pe, int p, lint v){
		if(e < ps || pe < s) return;
		if(s <= ps && pe <= e){
			tree[p] += v;
			lazy[p] += v;
			return;
		}
		lazydown(p);
		int pm = (ps + pe) / 2;
		add(s, e, ps, pm, 2*p, v);
		add(s, e, pm+1, pe, 2*p+1, v);
		tree[p] = max(tree[2*p], tree[2*p+1]);
	}
	lint query(int s, int e, int ps, int pe, int p){
		if(e < ps || pe < s) return -1e18;
		if(s <= ps && pe <= e) return tree[p];
		lazydown(p);
		int pm = (ps + pe) / 2;
		return max(query(s, e, ps, pm, 2*p), query(s, e, pm+1, pe, 2*p+1));
	}
public:
  void add(int s, int e, lint v) {
    add(s, e, 0, MAXN, 1, v);
  }
  lint query(int s, int e) {
    return query(s, e, 0, MAXN, 1);
  }
  void init() {
    memset(lazy, 0, sizeof lazy);
    memset(tree, 0, sizeof tree);
  }
}seg;

int W, H, N;
using pii = pair<int, int>;
vector<pii> points;

lint solve() {
  lint ret = 0;
  
  seg.init();

  sort(points.begin(), points.end());

  stack<pii> up, down;
  for(int i = 0; i < int(points.size()); i++) {
    int x, y; tie(x, y) = points[i];
    if(y > H/2) {
      int j = i;
      while(!up.empty() && up.top().first > y) {
        seg.add(up.top().second, j-1, (y - up.top().first));
        j = up.top().second;
        up.pop();
      }
      if(j < i) {
        up.emplace(y, j);
      }
    }else {
      int j = i;
      while(!down.empty() && down.top().first < y) {
        seg.add(down.top().second, j-1, -(y - down.top().first));
        j = down.top().second;
        down.pop();
      }
      if(j < i) {
        down.emplace(y, j);
      }
    }
    up.emplace(H, i);
    down.emplace(0, i);

    seg.add(i, i, H - x);
    ret = max(ret, seg.query(0, i) + (i+1 < points.size() ? points[i+1].first : 0));
  }
  
  ret *= 2;
  return ret;
}

int main() {
#ifdef IN_MY_COMPUTER
  freopen("f.in", "r", stdin);
#endif
  scanf("%d%d%d", &W, &H, &N);
  for(int i = 0; i < N+2; i++) {
    int x, y; 
    if(i < N) scanf("%d%d", &x, &y);
    else if(i == N) x = 0, y = 0;
    else x = W, y = H;
    points.emplace_back(x, y);
  }

  lint ans1 = solve();

  swap(H, W);
  for(pii &p : points) {
    swap(p.first, p.second);
  }

  lint ans2 = solve();
  
  printf("%lld\n", max(ans1, ans2));
  return 0;
}