#include <bits/stdc++.h>
int a[1000001], b[1000001];
char st[1000001];
using namespace std;
int main() {
  long long i, j, n, m, count = 0, sum = 0, temp = 0, l, ans = 0, xa, xb, ya,
                        yb;
  int p, q, r, s;
  vector<int> v;
  set<int> set;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> xa >> ya >> xb >> yb;
    ans += (xb - xa + 1) * (yb - ya + 1);
  }
  cout << ans;
}
