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 <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << 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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  vector<ll> ys;
  vector<tuple<ll,ll,ll,ll>> rectangles;
  ll n;
  cin >> n;
  rep(i,n) {
    ll x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    rectangles.emplace_back(x1,y1,x2,y2);
    ys.push_back(y1);
    ys.push_back(y2);
  }
  sort(all(ys)); // increasing order
  ys.erase(unique(all(ys)), ys.end()); // uniquify

  ll ans = 0;
  rep(i, ys.size()-1) {
    ll miny = ys[i];
    ll maxy = ys[i+1];
    vector<P> xs; // <x,type>. type = 0 .. open, type = 1 .. close.
    for (auto& rec : rectangles) {
      ll x1,y1,x2,y2;
      tie(x1,y1,x2,y2) = rec;
      if (y1 <= miny && maxy <= y2) { // rec is effective.
        xs.emplace_back(x1, 0); // open
        xs.emplace_back(x2, 1); // close
      }
    }
    sort(all(xs));
    ll dx = 0;
    ll cnt = 0;
    ll pre = 0;
    for (auto& p : xs) {
      if (p.second == 0) { // open
        if (cnt == 0) {
          pre = p.first;
        }
        ++cnt;
      } else { // p.second == 1. close
        if (cnt == 1) {
          dx += p.first - pre;
        }
        --cnt;
      }
    }
    ans += dx*(maxy-miny);
  }
  cout << ans << endl;
}

