#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long p = 0;
  while (n--) {
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    p += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << p << endl;
  return 0;
}
