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