#include <bits/stdc++.h>
using namespace std;
long long m, n, x, y, p, q;
int main() {
  cin >> n;
  for (long long k = 0; k < n; k++) {
    cin >> x >> y >> p >> q;
    m += (p - x + 1) * (q - y + 1);
  }
  cout << m;
}
