| 记录编号 | 351335 | 评测结果 | AAAAAAAAAA | 
    
        | 题目名称 | 2549.删除他们! | 最终得分 | 100 | 
    
        | 用户昵称 |  Riolu | 是否通过 | 通过 | 
    
        | 代码语言 | C++ | 运行时间 | 0.000 s | 
    
        | 提交时间 | 2016-11-16 14:38:14 | 内存使用 | 0.00 MiB | 
    
    
    
    		显示代码纯文本
		
		/*=========================================*
  * Auther: Riolu
  * Time: 2016.11.16
  * ©Copyright 2016 Riolu. All Rights Reserved.
  *=========================================*/
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<ctime>
#include<cstring>
using namespace std;
typedef long long ll;
typedef double db;
const int N =1e6+1;
int n,m,q;
int a[N],x1,x2,y1,y2,s,xs,ys;
inline void change(){xs=(s-1)/m;ys=s-xs*m-1;}
int M(){
	freopen("deleteit.in","r",stdin);
	freopen("deleteit.out","w",stdout);
	cin>>n>>m>>q;
	s=n*m;xs=n-1;ys=m-1;
	while(q){
		q--;
		cin>>x1>>y1>>x2>>y2;
		if(x1>x2)	swap(x1,x2);
		if(y1>y2)	swap(y1,y2);
		if(x1>xs)	continue;
		s-=((x2-x1+1)*(y2-y1+1));
		if(x2<xs)	change();
		else{
			s+=((x2-xs)*(y2-y1+1));
			if(y1>ys) 	s+=(y2-y1+1);
			else if(y2<=ys)	change();
			else s+=(y2-ys);
			change();
		}
	}
	cout<<s<<endl;
	fclose(stdin);fclose(stdout);
	return 0;
}int K=M();int main(){;}