#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') {
      flag = 1;
    }
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  if (flag) {
    x = -x;
  }
}
const int N = 300005;
int w, h, n, x[N], y[N], ans;
int px[N], nx, py[N], ny;
struct SegmentTree {
  int l[N << 2], r[N << 2];
  int val[N << 2], lazy[N << 2];
  inline void pushup(int p) {
    val[p] = max(val[p << 1], val[p << 1 | 1]);
  }
  void build(int p, int L, int R) {
    l[p] = L, r[p] = R;
    val[p] = -py[L - 1] + w;
    lazy[p] = 0;
    if (L == R) {
      return;
    }
    int mid = l[p] + r[p] >> 1;
    build(p << 1, L, mid);
    build(p << 1 | 1, mid + 1, R);
  }
  inline void tag(int p, int v) {
    val[p] += v;
    lazy[p] += v;
  }
  inline void pushdown(int p) {
    if (lazy[p]) {
      tag(p << 1, lazy[p]);
      tag(p << 1 | 1, lazy[p]);
      lazy[p] = 0;
    }
  }
  void modify(int p, int L, int R, int v) {
    if (l[p] >= L && r[p] <= R) {
      tag(p, v);
      return;
    }
    pushdown(p);
    int mid = l[p] + r[p] >> 1;
    if (mid >= L) {
      modify(p << 1, L, R, v);
    }
    if (mid < R) {
      modify(p << 1 | 1, L, R, v);
    }
    pushup(p);
  }
} smt;
inline void process() {
  static int lef[N], rig[N];
  smt.build(1, 1, ny);
  for (int i = 1; i <= ny; ++i) {
    lef[i] = 0;
    rig[i] = w;
  }
  for (int i = 1; i <= n; ++i) {
    int X = px[x[i]], Y = y[i];
    if (X <= w / 2) {
      lef[Y] = max(lef[Y], X);
    } else {
      rig[Y] = min(rig[Y], X);
    }
  }
  static int sl[N], sr[N];
  int tl = 0, tr = 0;
  for (int i = 1; i <= ny; ++i) {
    ans = max(ans, 2 * (py[i] + smt.val[1]));
    smt.modify(1, i, i, -lef[i] + rig[i] - w);
    while (tl && lef[sl[tl]] < lef[i]) {
      smt.modify(1, sl[tl - 1] + 1, sl[tl], lef[sl[tl]] - lef[i]);
      --tl;
    }
    sl[++tl] = i;
    while (tr && rig[sr[tr]] > rig[i]) {
      smt.modify(1, sr[tr - 1] + 1, sr[tr], rig[i] - rig[sr[tr]]);
      --tr;
    }
    sr[++tr] = i;
  }
}
int main() {
  scanf("%d%d%d", &w, &h, &n);
  px[nx = 2] = w;
  py[ny = 2] = h;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    px[++nx] = x[i];
    py[++ny] = y[i];
  }
  sort(px + 1, px + nx + 1);
  sort(py + 1, py + ny + 1);
  nx = unique(px + 1, px + nx + 1) - px - 1;
  ny = unique(py + 1, py + ny + 1) - py - 1;
  for (int i = 1; i <= n; ++i) {
    x[i] = lower_bound(px + 1, px + nx + 1, x[i]) - px;
    y[i] = lower_bound(py + 1, py + ny + 1, y[i]) - py;
  }
  process();
  swap(w, h);
  swap(px, py);
  swap(nx, ny);
  swap(x, y);
  process();
  printf("%d\n", ans);
  return 0;
}