#include<bits/stdc++.h> #define int long long #define PII pair<int, int>
usingnamespace std;
constint mod = 1e9 + 7; int H, W; int n; PII a[40]; int siz[70][70]; bool vis_bl[70][70]; int vis[70][70]; int lshh[70], lshw[70]; int ans; queue<PII> q; int dist[70][70]; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signedmain() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> H >> W; cin >> n; ans = W * W % mod * ((H - 1) * H * (H + 1) / 6 % mod) % mod; ans = (ans + H * H % mod * ((W - 1) * W * (W + 1) / 6 % mod) % mod) % mod; lshh[1] = 0; lshw[1] = 0; for(int i = 1;i <= n;i ++) { cin >> a[i].first >> a[i].second; lshh[i * 2] = a[i].first; lshh[i * 2 + 1] = a[i].first + 1; lshw[i * 2] = a[i].second; lshw[i * 2 + 1] = a[i].second + 1; int x = a[i].first, y = a[i].second; int sx = x * (x + 1) / 2 + (H - x - 1) * (H - x) / 2; int sy = y * (y + 1) / 2 + (W - y - 1) * (W - y) / 2; ans = (ans - W % mod * (sx % mod) % mod + mod) % mod; ans = (ans - H % mod * (sy % mod) % mod + mod) % mod; } lshh[2 * n + 2] = H; lshw[2 * n + 2] = W; sort(lshh + 1, lshh + 2 * n + 3); sort(lshw + 1, lshw + 2 * n + 3); int cnth = unique(lshh + 1, lshh + 2 * n + 3) - lshh - 2; int cntw = unique(lshw + 1, lshw + 2 * n + 3) - lshw - 2; for(int i = 1;i <= n;i ++) { for(int j = i + 1;j <= n;j ++) { ans = (ans + abs(a[i].first - a[j].first) + abs(a[i].second - a[j].second)) % mod; } } for(int i = 1;i <= cnth;i ++) { for(int j = 1;j <= cntw;j ++) { siz[i][j] = (lshh[i + 1] - lshh[i]) * (lshw[j + 1] - lshw[j]) % mod; } } for(int i = 1;i <= n;i ++) { int ah = lower_bound(lshh + 1, lshh + cnth + 2, a[i].first) - lshh; int aw = lower_bound(lshw + 1, lshw + cntw + 2, a[i].second) - lshw; vis_bl[ah][aw] = 1; } for(int sx = 1;sx <= cnth;sx ++) { for(int sy = 1;sy <= cntw;sy ++) { if(vis_bl[sx][sy]) continue; memset(vis, 0, sizeof(vis)); while(!q.empty()) q.pop(); q.push({sx, sy}); vis[sx][sy] = 1; while(!q.empty()) { PII t = q.front(); q.pop(); for(int i = 0; i < 4; i ++) { int nx = t.first + dx[i], ny = t.second + dy[i]; if(nx <= 0 || ny <= 0 || nx > cnth || ny > cntw || vis_bl[nx][ny] || vis[nx][ny]) continue; vis[nx][ny] = vis[t.first][t.second] + 1; q.push({nx, ny}); } } for(int i = 1;i <= cnth;i ++) { for(int j = 1;j <= cntw;j ++) { if(i < sx || (i == sx && j <= sy) || vis_bl[i][j] || !vis[i][j]) continue; vis[i][j] --; int ex = vis[i][j] - abs(i - sx) - abs(j - sy); ans = (ans + ex * siz[sx][sy] % mod * siz[i][j] % mod) % mod; } } } } cout << ans; return0; }