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