Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.

Constraints

* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $

Input

The input is given in the following format.

$N$
$x1_1$ $y1_1$ $x2_1$ $y2_1$
$x1_2$ $y1_2$ $x2_2$ $y2_2$
:
$x1_N$ $y1_N$ $x2_N$ $y2_N$


($x1_i, y1_i$) and ($x2_i, y2_i$) are the coordinates of the top-left corner and the bottom-right corner of the $i$-th rectangle respectively.

Output

Print the area of the regions.

Examples

Input

2
0 0 3 4
1 2 4 3


Output

13


Input

3
1 1 2 5
2 1 5 2
1 2 2 5


Output

7


Input

4
0 0 3 1
0 0 1 3
0 2 3 3
2 0 3 3


Output

8
#include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INF = 2147483647;
const long long LINF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
	int N; cin >> N;
    VI x1(N), y1(N), x2(N), y2(N); REP(i,N) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    vector<ll> wx, wy;
    REP(i,N){
        wx.push_back(x1[i]); wx.push_back(x2[i]);
        wy.push_back(y1[i]); wy.push_back(y2[i]);
    }
    SORT(wx); wx.erase(unique(ALL(wx)), wx.end());
    SORT(wy); wy.erase(unique(ALL(wy)), wy.end());

    VVI fld(wx.size()+1, VI(wy.size()+1,0));
    REP(i,N){
        int p1 = LB(wx, x1[i]), p2 = LB(wx, x2[i]);
        int p3 = LB(wy, y1[i]), p4 = LB(wy, y2[i]);
        fld[p1][p3]++; fld[p1][p4]--; fld[p2][p3]--; fld[p2][p4]++;
    }
    REP(i,wx.size())REP(j,wy.size()) fld[i+1][j] += fld[i][j];
    REP(i,wx.size())REP(j,wy.size()) fld[i][j+1] += fld[i][j];
    ll ans = 0;
    REP(i,wx.size()-1)REP(j,wy.size()-1){
        if(fld[i][j]) ans += (wx[i+1]-wx[i])*(wy[j+1]-wy[j]);
    }
    cout << ans << endl;
    return 0;
}
