#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, a, b, c, d;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    sum = sum + (c - a + 1) * (d - b + 1);
  }
  cout << sum;
}
