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