#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int table = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a, b, x, y;
    scanf("%d %d %d %d", &a, &b, &x, &y);
    table += (x - a + 1) * (y - b + 1);
  }
  printf("%d", table);
  return 0;
}
