#include <bits/stdc++.h>
using namespace std;
bool debug = true;
int main() {
  int n;
  int x1, y1, x2, y2;
  int ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    ans += (abs(x1 - x2) + 1) * (abs(y1 - y2) + 1);
  }
  cout << ans << endl;
  return 0;
}
