#include <bits/stdc++.h>
using namespace std;
int main() {
  int res = 0, t, x1, y1, x2, y2;
  cin >> t;
  while (t--) {
    cin >> y1 >> x1 >> y2 >> x2;
    res += ((y2 - y1 + 1) * (x2 - x1 + 1));
  }
  cout << res;
  return 0;
}
