#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n, ans;
  int x1, y1, x2, y2;
  int arr[101][101];
  for (a = 0; a < 101; a++)
    for (b = 0; b < 101; b++) arr[a][b] = 0;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &x1);
    scanf("%d", &y1);
    scanf("%d", &x2);
    scanf("%d", &y2);
    for (a = y1; a <= y2; a++)
      for (b = x1; b <= x2; b++) {
        arr[101 - a][b]++;
      }
  }
  ans = 0;
  for (a = 0; a < 101; a++)
    for (b = 0; b < 101; b++) {
      if (arr[a][b] != 0) ans += arr[a][b];
    }
  printf("%d\n", ans);
  return 0;
}
