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