#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
const int mod = (int)1e9 + 7;
const double eps = 1e-6;
const double pi = acos(-1.0);
long long n, m;
int main() {
  int a, b, c, d;
  int ans = 0;
  int t;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    ans += (c - a + 1) * (d - b + 1);
  }
  cout << ans << endl;
  return 0;
}
