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