#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
#pragma hdrstop
using namespace std;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-9;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 1000000007;
void solve(std::istream& in, std::ostream& out) {
  int n;
  in >> n;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int xa, ya, xb, yb;
    in >> xa >> ya >> xb >> yb;
    ans += (xb - xa + 1) * (yb - ya + 1);
  }
  out << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
