#include #include #include #include #include #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // const int MOD = 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; // const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, // dx[] = {0, -1, -1, -1, 0, 1, 1, 1}; struct IOSetup { IOSetup() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); cerr << fixed << setprecision(10); } } iosetup; /*-------------------------------------------------*/ int main() { long long w, h; int n; cin >> w >> h >> n; vector x(n), y(n); REP(i, n) cin >> x[i] >> y[i]; FOR(i, 1, n) { if ((x[0] + y[0]) % 2 != (x[i] + y[i]) % 2) { cout << "0\n"; return 0; } } long long ans = 0; REP(rot, 4) { REP(flip, 2) { long long mn_x = LINF, mx_x = -LINF, mn_y = LINF, mx_y = -LINF, mn_plus = LINF, mx_plus = -LINF, mn_minus = LINF, mx_minus = -LINF; REP(i, n) { mn_x = min(mn_x, x[i]); mx_x = max(mx_x, x[i]); mn_y = min(mn_y, y[i]); mx_y = max(mx_y, y[i]); mn_plus = min(mn_plus, x[i] + y[i]); mx_plus = max(mx_plus, x[i] + y[i]); mn_minus = min(mn_minus, x[i] - y[i]); mx_minus = max(mx_minus, x[i] - y[i]); } if (n == 2) { if (mn_plus == mx_plus) ans = max(ans, mn_x * mn_y + (w - mx_x + 1) * (h - mx_y + 1) + mx_x - mn_x - 1); if (mx_x - mn_x < mx_y - mn_y) ans = max(ans, w); } else { if (mn_plus == mx_plus) ans = max(ans, mn_x * mn_y + (w - mx_x + 1) * (h - mx_y + 1)); bool flag = true; if (mx_plus - mn_plus >= mx_minus - mn_minus) { REP(i, n) flag &= x[i] + y[i] == mx_plus || x[i] + y[i] == mn_plus; if (flag) ans = max(ans, ((mx_plus - mx_minus) - (mx_minus - mn_minus)) / 2 + 1); } flag = true; int cnt = 0; REP(i, n) { if (x[i] + y[i] != mx_plus) { ++cnt; flag &= x[i] - y[i] == mx_minus; } } if (flag && cnt == 1) { long long tmp = LINF; REP(i, n) if (x[i] + y[i] == mx_plus) tmp = min(tmp, x[i]); ans = max(ans, tmp); } if (mx_plus - mn_plus >= mx_minus - mn_minus) { flag = true; REP(i, n) flag &= x[i] + y[i] == mx_plus || x[i] + y[i] == mn_plus || x[i] - y[i] == mx_minus; if (flag) ans = max(ans, 1LL); } if (mx_plus - mn_plus == mx_minus - mn_minus) { flag = true; REP(i, n) flag &= x[i] + y[i] == mx_plus || x[i] + y[i] == mn_plus || x[i] - y[i] == mx_minus || x[i] - y[i] == mn_minus; if (flag) ans = max(ans, 1LL); } } REP(i, n) y[i] = h - y[i] + 1; } REP(i, n) { swap(x[i], y[i]); (y[i] *= -1) += h + 1; swap(h, w); } } cout << ans << '\n'; return 0; }