#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long test, i, j, xy, flag = 0, n, u, count, d, o1 = 0, o2 = 0, s, e, l,
                            r, x, y, m, z, max1, x1, y1, k, x2, y2, z1, sum, f,
                            min1;
  string a;
  cin >> n;
  sum = 0;
  for (i = 0; i < n; i++) {
    cin >> x >> y >> x1 >> y1;
    x2 = (x1 - x) + 1;
    x2 *= (y1 - y) + 1;
    sum += x2;
  }
  cout << sum << "\n";
  return 0;
}
