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