#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  int x1, y1, x2, y2;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    ans += (long long)(x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << ans << endl;
}
