#include <bits/stdc++.h>
using namespace std;
int n, a[100][4];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> a[i][j];
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (a[i][2] - a[i][0] + 1) * (a[i][3] - a[i][1] + 1);
  }
  cout << sum;
  return 0;
}
