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