#include <bits/stdc++.h>
int main(int argc, char *argv[]) {
  int n, i, a, b, c, d;
  long int s;
  scanf("%d", &n);
  s = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &a, &b, &c, &d);
    s = s + (1 + abs(a - c)) * (1 + abs(b - d));
  }
  printf("%ld", s);
  return 0;
}
