#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, x1, y1, x2, y2, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    ans += (abs(x2 - x1) + 1) * (abs(y2 - y1) + 1);
  }
  cout << ans;
  return 0;
}
