#include <bits/stdc++.h>
using namespace std;
int readint() {
  int cc = getc(stdin);
  for (; cc < '0' || cc > '9';) cc = getc(stdin);
  int ret = 0;
  for (; cc >= '0' && cc <= '9';) {
    ret = ret * 10 + cc - '0';
    cc = getc(stdin);
  }
  return ret;
}
unsigned long long mod_pow(unsigned long long num, unsigned long long pow,
                           unsigned long long mod) {
  unsigned long long test;
  unsigned long long n = num;
  for (test = 1; pow; pow >>= 1) {
    if (pow & 1) test = ((test % mod) * (n % mod)) % mod;
    n = ((n % mod) * (n % mod)) % mod;
  }
  return test;
}
long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
struct node {
  int index;
  int vote;
};
int compare(const void *elem1, const void *elem2) {
  int x = (*(struct node *)elem1).vote - (*(struct node *)elem2).vote;
  if (x == 0) {
    int y = (*(struct node *)elem1).index - (*(struct node *)elem2).index;
    return y;
  } else
    return x;
}
int main() {
  int t;
  scanf("%d", &t);
  int x1, y1, x2, y2;
  long long sum = 0;
  while (t--) {
    scanf("%d", &x1);
    scanf("%d", &y1);
    scanf("%d", &x2);
    scanf("%d", &y2);
    sum += (y2 - y1 + 1) * (x2 - x1 + 1);
  }
  printf("%lld\n", sum);
}
