#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int maxn = 505 * 1001;
const int Base = 199;
int ans[110][110], Answer, n, x, X2, y, Y2;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y >> X2 >> Y2;
    if (x > X2) swap(x, X2);
    if (y > Y2) swap(y, Y2);
    for (int j = x; j <= X2; j++)
      for (int k = y; k <= Y2; k++) ans[j][k]++;
  }
  for (int i = 1; i <= 100; i++)
    for (int j = 1; j <= 100; j++) Answer += ans[i][j];
  cout << Answer;
  return 0;
}
