#include <bits/stdc++.h>
using namespace std;
int main() {
  int x[2][100], y[2][100];
  int i, j, n;
  long long ans = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x[0][i];
    cin >> x[1][i];
    cin >> y[0][i];
    cin >> y[1][i];
  }
  for (i = 0; i < n; i++) {
    ans += (y[0][i] - x[0][i] + 1) * (y[1][i] - x[1][i] + 1);
  }
  cout << ans;
}
