#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  int n;
  cin >> n;
  int ans = 0;
  while (n--) {
    int xt, yt, xb, yb;
    cin >> xt >> yt >> xb >> yb;
    ans += (xb - xt + 1) * (yb - yt + 1);
  }
  cout << ans;
  return 0;
}
