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