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
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/compress.hpp"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#ifndef COMPRO_COMPRESS
#define COMPRO_COMPRESS

template <class T> class Compress {
public:
  explicit Compress(const std::vector<T> &argv) {
    isBuilt = false;
    add(argv);
  }

  Compress() { isBuilt = false; }

  void add(const std::vector<T> &argv) {
    for (const auto &x : argv) {
      add(x);
    }
  }
  void add(const T x) {
    assert(!isBuilt);
    v.emplace_back(x);
  }

  void build() {
    isBuilt = true;
    std::sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
  }

  int get(const T x) const {
    assert(isBuilt);
    return lower_bound(v.begin(), v.end(), x) - v.begin();
  }

  const T &operator[](const int k) const { return v[k]; }

  int size() const { return v.size(); }

private:
  std::vector<T> v;
  bool isBuilt;
};
#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 3 "tmp.cpp"

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

  int n;
  cin >> n;
  vl vx1, vx2, vy1, vy2;
  Compress<ll> vx, vy;
  REP(i, n) {
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    vx1.emplace_back(x1);
    vx2.emplace_back(x2);
    vy1.emplace_back(y1);
    vy2.emplace_back(y2);
  }

  vx.add(vx1);
  vx.add(vx2);
  vy.add(vy1);
  vy.add(vy2);
  vx.build();
  vy.build();

  REP(i, n) {
    vx1[i] = vx.get(vx1[i]);
    vx2[i] = vx.get(vx2[i]);
    vy1[i] = vy.get(vy1[i]);
    vy2[i] = vy.get(vy2[i]);
  }

  vector<vi> imos(2 * n, vi(2 * n, 0));
  REP(i, n) {
    imos[vx1[i]][vy1[i]]++;
    imos[vx2[i]][vy1[i]]--;
    imos[vx1[i]][vy2[i]]--;
    imos[vx2[i]][vy2[i]]++;
  }

  REP(i, 2 * n) {
    FOR(j, 1, 2 * n) { imos[i][j] += imos[i][j - 1]; }
  }
  REP(j, 2 * n) {
    FOR(i, 1, 2 * n) { imos[i][j] += imos[i - 1][j]; }
  }
  int xSize = vx.size();
  int ySize = vy.size();

  ll ans = 0;
  REP(i, xSize - 1) {
    REP(j, ySize - 1) {
      if (imos[i][j] > 0)
        ans += (vx[i + 1] - vx[i]) * (vy[j + 1] - vy[j]);
    }
  }

  cout << ans << endl;
  return 0;
}

