#include <bits/stdc++.h>
using namespace std;
inline void boost() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
}
const long long maxn = 1e5 + 123;
const long long inf = 1e9 + 123;
const long long mod = 1e9 + 7;
const double pi = acos(-1);
int main() {
  boost();
  int n;
  cin >> n;
  int cntr = 0;
  for (int i = 1; i <= n; i++) {
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cntr += ((x2 - x1 + 1) * (y2 - y1 + 1));
  }
  cout << cntr;
  return 0;
}
