#include <bits/stdc++.h>
using namespace std;
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
  }
  int n, x1, x2, y1, y2, ans = 0;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2;
    ans += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << ans << endl;
}
