#include <bits/stdc++.h>
using namespace std;
static const int mod = 1e9 + 7;
static const int mmx = 1e7 + 5;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main() {
  int n, i, a, b, c, d;
  while (scanf("%d", &n) == 1) {
    int sum = 0;
    for (i = 0; i < n; i++) {
      scanf("%d %d %d %d", &a, &b, &c, &d);
      int w = abs(c - a) + 1;
      int ww = abs(d - b) + 1;
      sum += (w * ww);
    }
    printf("%d\n", sum);
  }
  return 0;
}
