#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const double EXP = 2.7182818284590452;
const double Pi = 3.14159265;
const double EPS = 1e-13;
const int INF = 1000 * 1000 * 1000;
const long long INFL = (long long)INF * (long long)INF;
int n;
int arr[4];
long long res = 0;
void accept() {
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (4); ++j) scanf("%d", arr + j);
    res += (arr[2] - arr[0] + 1) * (arr[3] - arr[1] + 1);
  }
  cout << res;
}
int main(void) {
  accept();
  return 0;
}
