#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100 + 10;
int n;
int a[MaxN][MaxN];
int ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    ans += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << ans << endl;
  return 0;
}
