#include <bits/stdc++.h>
using namespace std;
const int N = 0;
int n;
int main() {
  int x1, y1, x2, y2;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    int one = x2 - x1 + 1;
    int two = y2 - y1 + 1;
    sum += one * two;
  }
  cout << sum;
}
