#include <bits/stdc++.h>
int modul(int a) { return a < 0 ? -a : a; }
int n, res, a, b, c, d;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d %d %d", &a, &b, &c, &d);
    res += (modul(a - c) + 1) * (modul(b - d) + 1);
  }
  printf("%d", res);
  return 0;
}
