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