#include <bits/stdc++.h>
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int a, b, x, y;
    int sum = 0;
    while (n--) {
      scanf("%d%d%d%d", &x, &y, &a, &b);
      sum += (a - x + 1) * (b - y + 1);
    }
    printf("%d\n", sum);
  }
}
