#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, sum = 0;
  cin >> t;
  for (t; t != 0; t--) {
    int x1, x2, y1, y2, row = 0, col = 0;
    cin >> x1 >> y1 >> x2 >> y2;
    row = x2 - (x1 - 1);
    col = y2 - (y1 - 1);
    sum = sum + (row * col);
  }
  cout << sum << endl;
  return 0;
}
