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