#include <bits/stdc++.h>
using namespace std;
template <class T>
T _abs(T n) {
  return (n < 0 ? -n : n);
}
template <class T>
T _max(T a, T b) {
  return (!(a < b) ? a : b);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T sq(T x) {
  return x * x;
}
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
template <class T>
T power(T N, T P) {
  return (P == 0) ? 1 : N * power(N, P - 1);
}
template <class T>
std::string to_string(T const& value) {
  stringstream sstr;
  sstr << value;
  return sstr.str();
}
int main() {
  int i, j, k, l, n, m, x, y, X, Y, mini_x = 10000, mini_y = 100000, maxi_x = 0,
                                    maxi_y = 0;
  int memo[110][110];
  memset(memo, 0, sizeof memo);
  map<pair<int, int>, int> mp, mp2;
  scanf("%d", &n);
  while (n--) {
    scanf("%d %d %d %d", &x, &y, &X, &Y);
    mini_x = min(mini_x, x), mini_y = min(mini_y, y), maxi_x = max(maxi_x, X),
    maxi_y = max(maxi_y, Y);
    for (i = x; i <= X; i++) {
      for (j = y; j <= Y; j++) {
        memo[j][i]++;
      }
    }
  }
  int sum = 0;
  for (i = 1; i <= 100; i++) {
    for (j = 1; j <= 100; j++) sum += memo[i][j];
  }
  printf("%d\n", sum);
  return 0;
}
