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