#include <bits/stdc++.h>
using namespace std;
int grud[101][101];
int main() {
  int n;
  scanf("%d", &n);
  int x1, y1, x2, y2;
  int res = 0;
  while (n--) {
    scanf("%d", &x1);
    scanf("%d", &y1);
    scanf("%d", &x2);
    scanf("%d", &y2);
    res += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << res << endl;
}
