#include <bits/stdc++.h>
int rect;
int i;
int rects[100][4];
int main() {
  scanf("%d", &rect);
  for (i = 0; i < rect; i++) {
    scanf("%d", &rects[i][0]);
    scanf("%d", &rects[i][1]);
    scanf("%d", &rects[i][2]);
    scanf("%d", &rects[i][3]);
  }
  int x = 0;
  for (i = 0; i < rect; i++) {
    x += ((rects[i][2] + 1) - rects[i][0]) * ((rects[i][3] + 1) - rects[i][1]);
  }
  printf("%d", x);
  return 0;
}
