#include <bits/stdc++.h>
using namespace std;
int n, x1, x2, y11111, y2, res = 0;
int u[1100][1100];
int main() {
  memset(u, 0, sizeof(u));
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y11111 >> x2 >> y2;
    for (int j = x1; j <= x2; j++)
      for (int k = y11111; k <= y2; k++) u[j][k]++;
  }
  for (int i = 0; i <= 1000; i++)
    for (int j = 0; j <= 1000; j++) res += u[i][j];
  cout << res;
  return 0;
}
