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
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
}

void solve(){
    /* (´~`) */
    ll n;cin>>n;
    vl x1(n),y1(n),x2(n),y2(n);
    rep(i,n)cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];

    vl cx,cy;
    rep(i,n){
        cx.push_back(x1[i]);
        cx.push_back(x2[i]);
        cy.push_back(y1[i]);
        cy.push_back(y2[i]);
    }
    sort(all(cx));
    sort(all(cy));
    cx.erase(unique(all(cx)),cx.end());
    cy.erase(unique(all(cy)),cy.end());
    map<ll,ll> mx,my;
    rep(i,cx.size())mx[cx[i]]=i;
    rep(i,cy.size())my[cy[i]]=i;

    vvl dp(cx.size(),vl(cy.size()));
    rep(i,n){
        ++dp[mx[x1[i]]][my[y1[i]]];
        --dp[mx[x2[i]]][my[y1[i]]];
        --dp[mx[x1[i]]][my[y2[i]]];
        ++dp[mx[x2[i]]][my[y2[i]]];
    }
    rep(i,cx.size())rep(j,cy.size()-1)dp[i][j+1]+=dp[i][j];
    rep(i,cy.size())rep(j,cx.size()-1)dp[j+1][i]+=dp[j][i];

    ll ans=0;
    rep(i,cx.size())rep(j,cy.size()){
        if(dp[i][j])ans+=(cx[i+1]-cx[i])*(cy[j+1]-cy[j]);
    }
    cout<<ans<<endl;
}
