#include <bits/stdc++.h>
using namespace std;
int itest = 1, ntest = 1;
int n;
int a[111][111];
void _solve() {
  int i, j, k;
  int res = 0;
  for (i = 1; i <= 100; i++) {
    for (j = 1; j <= 100; j++) {
      res += a[i][j];
    }
  }
  printf("%d\n", res);
}
void _input() {
  int i, j;
  int x1, y1, x3, y3;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d %d", &x1, &y1, &x3, &y3);
    for (j = x1; j <= x3; j++) {
      for (int k = y1; k <= y3; k++) {
        a[j][k]++;
      }
    }
  }
}
int main() {
  for (itest = 1; itest <= ntest; itest++) {
    _input();
    _solve();
  }
  return 0;
}
