#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, l, T, c = 0;
int a[1010];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    int x1, y1, y2, x2;
    cin >> x1 >> y1 >> x2 >> y2;
    c += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  cout << c;
}
