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;
using ll = long long;
using vi = vector<ll>;
const int LIMIT = 1e9 + 7;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

namespace /* ZahyoComp.cpp */ {
  template<class T>
  vector<T> compress(vector<T> &V){
    //Vを圧縮後の値にする 元の値を得るために重複削除ソート列であるSを返す
    vector<T> S = V;
    sort(S.begin(), S.end());
    S.erase( unique(S.begin(), S.end()), S.end() );
    for(int i=0; i<V.size(); i++){
      V[i] = lower_bound(S.begin(), S.end(), V[i]) - S.begin();
    }
    return S;
  }

  template<class T>
  vector<T> compress(vector<T> &V1, vector<T> &V2){
    //2つのVを一緒くたにして各々圧縮する 重複削除ソート列Sを返す
    vector<T> S;
    int N = V1.size();
    copy(V1.begin(), V1.end(), back_inserter(S));
    copy(V2.begin(), V2.end(), back_inserter(S));

    sort(S.begin(), S.end());
    S.erase( unique(S.begin(), S.end()), S.end() );
    for(int i=0; i<N; i++){
      V1[i] = lower_bound(S.begin(), S.end(), V1[i]) - S.begin();
      V2[i] = lower_bound(S.begin(), S.end(), V2[i]) - S.begin();
    }
    return S;
  }
}


int main(){
	int N;cin>>N;
  vi X1(N), X2(N), Y1(N), Y2(N);
  rep(i,N)cin>>X1[i]>>Y1[i]>>X2[i]>>Y2[i];

  vi X = compress(X1, X2);
  vi Y = compress(Y1, Y2);

  //DEBUG(X1);DEBUG(Y1);DEBUG(X2);DEBUG(Y2);

  //DEBUG(X);DEBUG(Y);

  int H = X.size();
  int W = Y.size();

  //圧縮した上で数える
  vector<vi> field(H, vi(W, 0));
  rep(i,N){
    for(int h=X1[i]; h<X2[i]; h++){
      for(int w=Y1[i]; w<Y2[i]; w++){
        field[h][w]++;
      }
    }
  }

  //rep(i,H)debug(field[i]);

  ll ans = 0;
  rep(i,H)rep(j,W)if(field[i][j]){
    ll rec = (X[i+1] - X[i]) * (Y[j+1] - Y[j]);
    //DEBUG(i,j,rec);
    ans += rec;
  }
  cout<<ans<<endl;
}
