#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, d, sumx;
int main(int argc, char** argv) {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b >> c >> d;
    sumx += (abs(d - (b - 1))) * (abs(c - (a - 1)));
  }
  cout << sumx;
  return 0;
}
