#include <bits/stdc++.h>
using namespace std ;
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(0)
ll n, m, k, x[15], y[15], u[15], v[15], X, Y, U, V, kq = 0, mod = 1e9 + 7 ;
bool b[15] ;
ll f(ll l, ll r) {
return ((r * (r + 1) / 2) % mod - (l * (l - 1) / 2) % mod + mod) % mod ;
}
ll sum(ll x, ll y, ll u, ll v) {
return f(x, u) * f(y, v) ;
}
bool intersect(ll x1, ll y1, ll u1, ll v1, ll x2, ll y2, ll u2, ll v2) {
if(u1 < x2 || u2 < x1) return 0 ;
if(v1 < y2 || v2 < y1) return 0 ;
X = max(x1, x2) ;
U = min(u1, u2) ;
Y = max(y1, y2) ;
V = min(v1, v2) ;
return 1 ;
}
void kt() {
X = 1, Y = 1, U = n, V = m ;
ll cnt = 0 ;
for(ll i = 1; i <= k; i ++) {
if(b[i] == 0) continue ;
cnt ++ ;
if(!intersect(x[i], y[i], u[i], v[i], X, Y, U, V)) return ;
}
ll t = sum(X, Y, U, V) % mod ;
if(cnt % 2 == 1) kq = ((kq - t) % mod + mod) % mod ;
else kq = (kq + t) % mod ;
}
void dequy(ll i) {
if(i > k) kt() ;
else {
dequy(i + 1) ;
b[i] = 1 ;
dequy(i + 1) ;
b[i] = 0 ;
}
}
int main() {
cin >> n >> m >> k ;
for(ll i = 1; i <= k; i ++) cin >> x[i] >> y[i] >> u[i] >> v[i] ;
dequy(1) ;
cout << kq ;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQgOwoKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSB1bGwgdW5zaWduZWQgbG9uZyBsb25nCiNkZWZpbmUgZmFzdGlvIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCkKCmxsIG4sIG0sIGssIHhbMTVdLCB5WzE1XSwgdVsxNV0sIHZbMTVdLCBYLCBZLCBVLCBWLCBrcSA9IDAsIG1vZCA9IDFlOSAr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