#include <bits/stdc++.h>
using namespace std;
int a[int(300)][int(300)], n, m, gjhfdjgk, x2, gnfkhfjkdgfhj, y2;
long long sum;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> gjhfdjgk >> gnfkhfjkdgfhj >> x2 >> y2;
    for (int j = gnfkhfjkdgfhj; j <= y2; j++)
      for (int z = gjhfdjgk; z <= x2; z++) a[j][z]++;
  }
  for (int i = 1; i <= 100; i++)
    for (int j = 1; j <= 100; j++) sum += a[i][j];
  cout << sum;
  return 0;
}
