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