#include <bits/stdc++.h>
using namespace std;
int n, res, X1, Y1, X2, Y2;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  while (n--) {
    cin >> X1 >> Y1 >> X2 >> Y2;
    res += (X2 - X1 + 1) * (Y2 - Y1 + 1);
  }
  cout << res;
  return 0;
}
