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