#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9;
int main() {
  int n, x1, y1, x2, y2, sum = 0;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2;
    int a = abs(y2 - y1 + 1);
    int b = abs(x2 - x1 + 1);
    sum += a * b;
  }
  cout << sum << endl;
  return 0;
}
