#include <bits/stdc++.h>
using namespace std;
const long long N = 2222;
int main() {
  long long sum = 0;
  int n;
  while (cin >> n) {
    int a, b, c, d;
    while (n--) {
      cin >> a >> b >> c >> d;
      sum += (c - a + 1) * (d - b + 1);
    }
    cout << sum << endl;
  }
  return 0;
}
