#include <bits/stdc++.h>
using namespace std;
int first, second, i, m, n, j, l, c, d, ls, ld, maxi, mini = 1000000000,
                                                      v[100005], ok, k, t;
char z, a[100005], b[100005];
bool cmp(char a, char b) {
  if (a > b) return 1;
  return 0;
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> first >> second >> c >> d;
    m += (c - first + 1) * (d - second + 1);
  }
  cout << m;
  return 0;
}
