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