#include<iostream>
using namespace std;
int main() {
int w, x, h;
cin >> w >> x >> h;
int q;
cin >> q;
int sum = w * x * h;
for (int i = 0; i < q; i++) {
int x1, y1, z1, x2, y2, z2;
cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
int x = x2 - x1 + 1; int y = y2 - y1 + 1; int z = z2 - z1 + 1;
int area = x * y * z;
sum -= area;
}
cout << sum;
}