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