#include <bits/stdc++.h>
int a[100][100];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    for (int j = x1 - 1; j < x2; j++) {
      for (int k = y1 - 1; k < y2; k++) {
        a[k][j]++;
      }
    }
  }
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      ans += a[i][j];
    }
  }
  printf("%d\n", ans);
  return 0;
}
