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