#include <bits/stdc++.h>
using namespace std;
void fast() {
  cout.sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  fast();
  int n, a, b, c, d, ans = 0;
  cin >> n;
  while (n--) {
    cin >> a >> b >> c >> d;
    ans += (c - a + 1) * (d - b + 1);
  }
  cout << ans << "\n";
  return 0;
}
