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