#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int T;
  cin >> T;
  long sum = 0;
  while (T--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    sum += (c - a + 1) * (d - b + 1);
  }
  cout << sum << endl;
}
