#include <bits/stdc++.h>
int main(int argc, char* argv[]) {
  int n;
  int x1, x2, y1, y2;
  scanf("%d", &n);
  int i;
  int count = 0;
  int p, q;
  for (i = 0; i < n; i++) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    for (p = x1; p <= x2; p++) {
      for (q = y1; q <= y2; q++) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
