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