#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = 0;
  while (n--) {
    int l, b, r, t;
    scanf("%d %d %d %d", &l, &b, &r, &t);
    sum += (r - l + 1) * (t - b + 1);
  }
  cout << sum;
}
