#include <bits/stdc++.h>
using namespace std;
int n;
int a, b, c, d, s;
int main() {
  cin >> n;
  for (; n; --n) {
    cin >> a >> b >> c >> d;
    s += (c - a + 1) * (d - b + 1);
  }
  cout << s;
  return 0;
}
