#include <bits/stdc++.h>
using namespace std;
int g[500][500]= {1};
int h[4];
int main(){
int a,b,c,e=0;
cin>>a>>b>>c;
for(int i=0; i<c; i++)
{
cin>>h[0]>>h[1]>>h[2]>>h[3];
if(h[0]>h[2]&&h[1]>h[3])
{
for(int k=h[2];k<=h[0];k+=1)
{int t=0;
if(g[k-1][h[3]+t-1]>0)
{
e++;
g[k-1][h[3]+t-1]=0;
}
t++;
}
}
else if(h[2]>h[0]&&h[3]>h[1])
{
for(int k=h[0]; k<=h[2]; k++)
{int t=0;
if(g[k-1][h[1]+t-1]>0)
{
e++;
g[k-1][h[1]+t-1]=0;
}
t++;
}
}
else if(h[2]>h[0]&&h[3]<h[1])
{
for(int k=h[0]; k<=h[2]; k++)
{int t=0;
if(g[k-1][h[1]-t-1]>0)
{
e++;
g[k-1][h[1]-t-1]=0;
}
t++;
}
}
else if(h[2]<h[0]&&h[3]>h[1])
{
for(int k=h[2]; k<=h[0]; k++)
{int t=0;
if(g[k-1][h[3]-t-1]>0)
{
e++;
g[k-1][h[3]-t-1]=0;
}
t++;
}
}
else if(h[2]>h[0])
{
for(int k=h[0]; k<=h[2];k++)
{
if(g[k-1][h[3]-1]>0)
{
e++;
g[k-1][h[3]-1]=0;
}
}
}
else if(h[2]<h[0])
{
for(int k=h[2]; k<=h[0]; k++)
{
if(g[k-1][h[3]-1]>0)
{
e++;
g[k-1][h[3]-1]=0;
}
}
}
else if(h[3]<h[1])
{
for(int k=h[3]; k<=h[1]; k++)
{
if(g[h[2]-1][k-1]>0)
{
e++;
g[h[2]-1][k-1]=0;
}
}
}
else if(h[3]>h[1])
{
for(int k=h[1]; k<=h[3]; k++)
{
if(g[h[2]-1][k-1]>0)
{
e++;
g[h[2]-1][k-1]=0;
}
}
}
}
cout<<e;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBnWzUwMF1bNTAwXT0gezF9OwppbnQgaFs0XTsKaW50IG1haW4oKXsKICAgIGludCBhLGIsYyxlPTA7CiAgICBjaW4+PmE+PmI+PmM7CiAgICAKICAgIGZvcihpbnQgaT0wOyBpPGM7IGkrKykKICAgIHsKICAgIAljaW4+PmhbMF0+PmhbMV0+PmhbMl0+PmhbM107CiAgICAgICAgaWYoaFswXT5oWzJdJiZoWzFdPmhbM10pCiAgICAgICAgewogICAgICAgICAgICBmb3IoaW50IGs9aFsyXTtrPD1oWzBdO2srPTEpCiAgICAgICAgICAgIHtpbnQgdD0wOwogICAgICAgICAgICAgICAgICAgIGlmKGdbay0xXVtoWzNdK3QtMV0+MCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgICAgICAgICAgICAgZ1trLTFdW2hbM10rdC0xXT0wOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0Kys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZihoWzJdPmhbMF0mJmhbM10+aFsxXSkKICAgICAgICB7CiAgICAgICAgICAgIGZvcihpbnQgaz1oWzBdOyBrPD1oWzJdOyBrKyspCiAgICAgICAgICAgIHtpbnQgdD0wOwogICAgICAgICAgICAgICAgICAgIGlmKGdbay0xXVtoWzFdK3QtMV0+MCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgICAgICAgICAgICAgZ1trLTFdW2hbMV0rdC0xXT0wOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0Kys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgICBlbHNlIGlmKGhbMl0+aFswXSYmaFszXTxoWzFdKQogICAgICAgIHsKICAgICAgICAgICAgZm9yKGludCBrPWhbMF07IGs8PWhbMl07IGsrKykKICAgICAgICAgICAge2ludCB0PTA7CiAgICAgICAgICAgICAgICAgICAgaWYoZ1trLTFdW2hbMV0tdC0xXT4wKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSsrOwogICAgICAgICAgICAgICAgICAgICAgICBnW2stMV1baFsxXS10LTFdPTA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHQrKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAgZWxzZSBpZihoWzJdPGhbMF0mJmhbM10+aFsxXSkKICAgICAgICB7CiAgICAgICAgICAgIGZvcihpbnQgaz1oWzJdOyBrPD1oWzBdOyBrKyspCiAgICAgICAgICAgIHtpbnQgdD0wOwogICAgICAgICAgICAgICAgICAgIGlmKGdbay0xXVtoWzNdLXQtMV0+MCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgICAgICAgICAgICAgZ1trLTFdW2hbM10tdC0xXT0wOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0Kys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgCiAgICAgICAgZWxzZSBpZihoWzJdPmhbMF0pCiAgICAgICAgewogICAgICAgICAgICBmb3IoaW50IGs9aFswXTsgazw9aFsyXTtrKyspCiAgICAgICAgICAgIHsKCiAgICAgICAgICAgICAgICBpZihnW2stMV1baFszXS0xXT4wKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgICAgICAgICBnW2stMV1baFszXS0xXT0wOwogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgfQoKCiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIGVsc2UgaWYoaFsyXTxoWzBdKQogICAgICAgIHsKICAgICAgICAgICAgZm9yKGludCBrPWhbMl07IGs8PWhbMF07IGsrKykKICAgICAgICAgICAgewoKICAgICAgICAgICAgICAgIGlmKGdbay0xXVtoWzNdLTFdPjApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZSsrOwogICAgICAgICAgICAgICAgICAgIGdbay0xXVtoWzNdLTFdPTA7CiAgICAgICAgICAgICAgICB9CgoKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgZWxzZSBpZihoWzNdPGhbMV0pCiAgICAgICAgewogICAgICAgICAgICBmb3IoaW50IGs9aFszXTsgazw9aFsxXTsgaysrKQogICAgICAgICAgICB7CgogICAgICAgICAgICAgICAgaWYoZ1toWzJdLTFdW2stMV0+MCkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBlKys7CiAgICAgICAgICAgICAgICAgICAgZ1toWzJdLTFdW2stMV09MDsKICAgICAgICAgICAgICAgIH0KCgogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBlbHNlIGlmKGhbM10+aFsxXSkKICAgICAgICB7CiAgICAgICAgICAgIGZvcihpbnQgaz1oWzFdOyBrPD1oWzNdOyBrKyspCiAgICAgICAgICAgIHsKCiAgICAgICAgICAgICAgICBpZihnW2hbMl0tMV1bay0xXT4wKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgICAgICAgICBnW2hbMl0tMV1bay0xXT0wOwogICAgICAgICAgICAgICAgfQoKCiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgfQogICAgICBjb3V0PDxlOwp9