#include <bits/stdc++.h>
using namespace std;
int main() {
  long long salida = 0;
  int x_1, x_2, y_1, y_2;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x_1 >> y_1 >> x_2 >> y_2;
    salida += (abs(x_2 - x_1) + 1) * (abs(y_2 - y_1) + 1);
  }
  cout << salida;
}
