#include <iostream>
#include <cstdio>
using namespace std;
int w, x, h, q;
struct node{
int w1, x1, h1;
int w2, x2, h2;
}a[105];
int main() {
cin >> w >> x >> h;
cin >> q;
for (int i = 1; i <= q; i++) {
cin >> a[i].w1 >> a[i].x1 >> a[i].h1 >> a[i].w2 >> a[i].x2 >> a[i].h2;
}
int sum = w * x * h;
for (int i = 1; i <= q; i++) {
sum -= (a[i].x2 - a[i].x1 + 1) * (a[1].w2 - a[i].w1 + 1) * (a[i].h2 - a[i].h1 + 1);
}
cout << sum << endl;
return 0;
}