#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); auto ab2xy = [](long long a, long long b) { return make_pair((a + b) / 2, (b - a) / 2); }; long long w, h; cin >> w >> h; int n; cin >> n; vector x(n), y(n), a(n), b(n); for (int i = 0; i < n; ++i) { cin >> x[i] >> y[i]; --x[i], --y[i]; a[i] = x[i] - y[i]; b[i] = x[i] + y[i]; if ((a[i] - a[0]) & 1) { cout << "0\n"; return 0; } } if (n == 2) { if (x[0] > x[1]) { swap(x[0], x[1]); swap(y[0], y[1]); } if (y[0] > y[1]) { y[0] = h - y[0] - 1; y[1] = h - y[1] - 1; } long long res = 0; if (x[0] - y[0] == x[1] - y[1]) { res += x[1] - x[0] - 1; res += (w - x[1]) * (y[0] + 1); res += (x[0] + 1) * (h - y[1]); } else { if (x[1] - x[0] < y[1] - y[0]) { swap(w, h); swap(x[0], y[0]); swap(x[1], y[1]); } res += y[1] - y[0] - 1; res += y[0] + 1; res += h - y[1]; } cout << res << '\n'; return 0; } set sa(begin(a), end(a)); set sb(begin(b), end(b)); long long min_x = *min_element(begin(x), end(x)); long long max_x = *max_element(begin(x), end(x)); long long min_y = *min_element(begin(y), end(y)); long long max_y = *max_element(begin(y), end(y)); long long min_a = *begin(sa), max_a = *rbegin(sa); long long min_b = *begin(sb), max_b = *rbegin(sb); long long res = 0, add = 0; if (sa.size() == 1 or sb.size() == 1) { if (sa.size() == 1) { res += (w - max_x) * (min_y + 1); res += (min_x + 1) * (h - max_y); } else { res += (w - max_x) * (h - max_y); res += (min_x + 1) * (min_y + 1); } } else { for (int S = 0; S < 1 << 4; ++S) { bool ok = true; for (int i = 0; i < n; ++i) { if (a[i] == min_a and S >> 0 & 1) continue; if (a[i] == max_a and S >> 1 & 1) continue; if (b[i] == min_b and S >> 2 & 1) continue; if (b[i] == max_b and S >> 3 & 1) continue; ok = false; break; } if (ok) { int cnt = __builtin_popcount(S); if (cnt == 4) { res = max(res, max_a - min_a == max_b - min_b); } else if (cnt == 3) { if ((S & 3) != 3) { res = max(res, max_a - min_a <= max_b - min_b); } else { res = max(res, max_b - min_b <= max_a - min_a); } } else { assert(cnt == 2); long long da = max_a - min_a; assert(~da & 1); da /= 2; long long db = max_b - min_b; assert(~db & 1); db /= 2; long long len = max(da, db); if (S == 3) { // res = max(res, max(da - db + 1, 0LL)); add += max(da - db, 0LL); } else if (S == 12) { // res = max(res, max(db - da + 1, 0LL)); add += max(db - da, 0LL); } else if (S == 5) { res = max(res, w - ab2xy(min_a + len, min_b + len).first); } else if (S == 6) { res = max(res, h - ab2xy(max_a - len, min_b + len).second); } else if (S == 9) { res = max(res, ab2xy(min_a + len, max_b - len).second + 1); } else { res = max(res, ab2xy(max_a - len, max_b - len).first + 1); } } // cerr << S << ' ' << res << '\n'; } } } res += add; cout << res << '\n'; /*else if (sa.size() == 2 or sb.size() == 2) { assert(false); long long da = max_a - min_a; assert(~da & 1); da /= 2; long long db = max_b - min_b; assert(~db & 1); db /= 2; long long len = max(da, db); if (sa.size() == 2) { int cmin_a = count(begin(a), end(a), min_a); int cmax_a = count(begin(a), end(a), max_a); long long min_ab = b[min_element(begin(a), end(a)) - begin(a)]; long long max_ab = b[max_element(begin(a), end(a)) - begin(a)]; if (cmin_a == 1 and min_ab == min_b) { res += max(h - ab2xy(max_a - len, min_b + len).second, 0LL); } else if (cmin_a == 1 and min_ab == max_b) { res += min(ab2xy(max_a - len, max_b - len).first + 1, w); } else if (cmax_a == 1 and max_ab == min_b) { res += max(w - ab2xy(min_a + len, min_b + len).first, 0LL); } else if (cmax_a == 1 and max_ab == max_b) { res += min(ab2xy(min_a + len, max_b - len).second + 1, h); } else { res += max(da - db + 1, 0LL); } } else { int cmin_b = count(begin(b), end(b), min_b); int cmax_b = count(begin(b), end(b), max_b); long long min_ba = a[min_element(begin(b), end(b)) - begin(b)]; long long max_ba = a[max_element(begin(b), end(b)) - begin(b)]; if (cmin_b == 1 and min_ba == min_a) { res += min(ab2xy(min_a + len, max_b - len).second + 1, h); } else if (cmin_b == 1 and min_ba == max_a) { res += min(ab2xy(max_a - len, max_b - len).first + 1, w); } else if (cmax_b == 1 and max_ba == min_a) { res += max(w - ab2xy(min_a + len, min_b + len).first, 0LL); } else if (cmax_b == 1 and max_ba == max_a) { res += max(h - ab2xy(max_a - len, min_b + len).second, 0LL); } else { res += max(db - da + 1, 0LL); } } } else { for (int i = 0; i < n; ++i) { if (a[i] != min_a and a[i] != max_a and b[i] != min_b and b[i] != max_b) { cout << "0\n"; return 0; } } set ta, tb; for (int i = 0; i < n; ++i) { if (a[i] != min_a and a[i] != max_a) { tb.insert(b[i]); } if (b[i] != min_b and b[i] != max_b) { ta.insert(a[i]); } } if (ta.size() == 2 and tb.size() == 2) { if (max_a - min_a != max_b - min_b) { res = 0; } } else if (ta.size() == 1 and tb.size() == 1) { } res = 1; } cout << res << '\n';*/ }