#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
int grid[maxn][maxn];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 0, x1, x2, y1, y2; i < n; i++) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    ans += (x2 - x1 + 1) * (y2 - y1 + 1);
  }
  printf("%d\n", ans);
}
