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