#include <bits/stdc++.h>
int main() {
  int n, x1, y1, x2, y2, i;
  long int sum = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    sum += (x2 - (x1 - 1)) * (y2 - (y1 - 1));
  }
  printf("%ld\n", sum);
  return 0;
}
