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