#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int aray[100][100] = {0};
  int x = 0, y = 0, x1 = 0, y1 = 0;
  int sum = 0;
  while (n--) {
    cin >> x >> y >> x1 >> y1;
    for (int i = y; i <= y1; i++) {
      for (int j = x; j <= x1; j++) {
        aray[i][j] += 1;
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
