#include <bits/stdc++.h>
using namespace std;
char buf[2048], *_s = buf + 2048;
inline char getc1(void) {
  if (_s >= buf + 2048) {
    fread(buf, 1, 2048, stdin);
    _s = buf;
  }
  return *(_s++);
}
inline int readint() {
  char t = getc1();
  int n = 1, res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = 10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline long long readLL() {
  char t = getc1();
  int n = 1;
  long long res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = 10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline char skipwhitespace() {
  char ch = getc1();
  while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = getc1();
  return ch;
}
inline int readline(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n')) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline int readstr(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != ' ' && ch != '\t')) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline char readchar() { return skipwhitespace(); }
char outbuf[2048];
int outbuf_p;
inline void putc1(char ch) {
  if (outbuf_p >= 2048) {
    fwrite(outbuf, 1, 2048, stdout);
    outbuf_p = 0;
  }
  outbuf[outbuf_p++] = ch;
}
inline void flush() {
  fwrite(outbuf, 1, outbuf_p, stdout);
  outbuf_p = 0;
}
inline void writeint(int n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[10];
  int i = 9;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 10) putc1(buf[i]);
}
inline void writeLL(long long n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[25];
  int i = 24;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 25) putc1(buf[i]);
}
inline void writestr(char *s) {
  char *p = s;
  while (*p) {
    putc1(*p);
    p++;
  }
}
inline void writedouble(double d, int p) {
  char buf[40];
  sprintf(buf, "%.*f", p, d);
  writestr(buf);
}
long long pow1(long long b, long long e, long long mod) {
  if (e == 0) return 1;
  long long ans = pow1(b, e / 2, mod);
  ans = (ans * ans) % mod;
  if (e & 1)
    return (ans * b) % mod;
  else
    return ans;
}
inline long long pow(long long b, long long e, long long mod) {
  if (e < 0)
    return pow1(pow1(b, -e, mod), mod - 2, mod);
  else
    return pow1(b, e, mod);
}
int egcd(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int d = egcd(b % a, a, x1, y1);
  x = y1 - x1 * (b / a);
  y = x1;
  return d;
}
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = egcd(b % a, a, x1, y1);
  x = y1 - x1 * (b / a);
  y = x1;
  return d;
}
long long inv(long long a, long long m) {
  long long inv, y;
  assert(egcd(a, m, inv, y) == 1);
  if (inv < 0) inv += m;
  return inv;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
vector<int> getfactors(int n) {
  vector<int> f;
  for (int a = 2; a * a <= n; a++) {
    int p = 1;
    while (n % a == 0) {
      n /= a;
      p *= a;
    }
    if (p > 1) f.push_back(p);
  }
  return f;
}
inline int getbit(long long n, int i) { return n & (1 << i); }
struct v {
  int x1, y1, x2, y2;
};
int main() {
  int n;
  scanf("%d", &n);
  int sum = 0;
  v ar[n];
  int row = 0, col = 0;
  for (int a = 0; a < n; a++) {
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    ar[a].x1 = x1;
    ar[a].y1 = y1;
    ar[a].x2 = x2;
    ar[a].y2 = y2;
    row = max(row, max(x1, x2));
    col = max(col, max(y1, y2));
  }
  for (int a = 1; a <= row; a++) {
    for (int b = 1; b <= col; b++) {
      for (v i : ar) {
        if (a >= i.x1 and a <= i.x2 and b >= i.y1 and b <= i.y2) sum++;
      }
    }
  }
  printf("%d\n", sum);
  return 0;
}
