#include <bits/stdc++.h>
using namespace std;
#define y1 kurduskus
const int MAX = 407;
const int MAXK = 500'007;
int x1[MAXK], y1[MAXK], x2[MAXK], y2[MAXK];
int d[MAX];
void upd(int& x, int val)
{
x = min(x, val);
}
int main()
{
int n, m, k;
cin >> n >> m >> k;
for(int i = 0; i < k; i++)
{
cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
}
int ans = 0;
for(int a = 1; a <= n; a++)
{
for(int j = 0; j < m; j++)
{
d[j] = INT_MAX;
}
for(int i = 0; i < k; i++)
{
if(x1[i] / a == x2[i] / a)
{
upd(d[min(y1[i], y2[i])], max(y1[i], y2[i]));
}
}
for(int b = 1; b <= m; b++)
{
bool ok = true;
for(int j = 0; j < m; j++)
{
ok &= j / b != d[j] / b;
}
if(ok)
{
ans = max(ans, a * b);
}
}
}
cout << ans << "\n";
return 0;
}