#include using namespace std; const int N = 1e4 + 10; int n, sum; bool p[N][N]; /* 2 2 2 9 5 6 1 12 9 */ void paint(int x1, int y1, int x2, int y2) { for (int i = x1; i < x2; i++) for (int j = y1; j < y2; j++) p[i][j] = 1; } int main() { cin >> n; for (int i = 1; i <= n; i++) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; paint(x1, y1, x2, y2); } for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) if (p[i][j]) sum++; printf("%d\n", sum); return 0; }