#include <bits/stdc++.h>
using namespace std;
int res, n, a1, b1, a2, b2;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &a1, &b1, &a2, &b2);
    res += (b2 - b1 + 1) * (a2 - a1 + 1);
  }
  printf("%d\n", res);
}
