#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, N;
  int ans = 0;
  int X1, X2, Y1, Y2;
  scanf("%d", &N);
  while (N--) {
    scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2);
    ans += (X2 - X1 + 1) * (Y2 - Y1 + 1);
  }
  cout << ans << endl;
  return 0;
}
