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