#include <bits/stdc++.h>
int main() {
  int t, num1 = 0, num2 = 0, arr[1000] = {0}, c = 0, sum = 0, i;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    num1 = (abs(x1 - x2)) + 1;
    num2 = (abs(y1 - y2)) + 1;
    arr[c] = num1 * num2;
    c++;
  }
  for (i = 0; i < c; i++) {
    sum = arr[i] + sum;
  }
  printf("%d\n", sum);
  return 0;
}
