#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x1, y1, x2, y2, Sum = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    Sum += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << Sum;
  return 0;
}
