#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int xa, ya, xb, yb;
  cin >> N;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    cin >> xa >> ya >> xb >> yb;
    for (int r = xa; r <= xb; r++) {
      for (int c = ya; c <= yb; c++) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
