1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>

using namespace std;

typedef long long int LL;

int n, X, Y;
vector <pair <int, LL> > xs, ys;

long long getLL(long long a = LLONG_MIN, long long b = LLONG_MAX){
	static mt19937_64 rng(2496820);
	return uniform_int_distribution <long long int> (a, b)(rng);
}

LL solve(vector <pair <int, LL> > in, int C){
	sort(in.begin(), in.end());
	in.push_back({C, 0});
	map <LL, int> M;
	
	int last = 0; LL pref = 0;
	for(auto v: in){
		M[pref] += v.first - last;
		last = v.first;
		pref ^= v.second;
	}
	
	int ans = 0;
	for(auto v: M)
		ans = max(ans, v.second);
	return ans;
}

int main(){
	scanf("%d %d %d", &n, &X, &Y);
	for(int i = 1; i <= n; ++i){
		int x1, y1, x2, y2;
		scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
		
		if(x1 > x2)	swap(x1, x2);
		if(y1 > y2)	swap(y1, y2);
		
		LL xrand = getLL(0, LLONG_MAX);
		LL yrand = getLL(0, LLONG_MAX);

		xs.push_back({x1, xrand});
		xs.push_back({x2, xrand});

		ys.push_back({y1, yrand});
		ys.push_back({y2, yrand});
	}
	
	printf("%lld\n", 1LL * solve(xs, X) * solve(ys, Y));
	return 0;
}