Example

Input

2 2 2 1
0 0 0


Output

24
#include<iostream>
#include<cmath>
using namespace std;
long long n, a[10000], b[10000], c[10000], cnt;
int main() {
	long long H, W, K; cin >> H >> W >> K >> n; cnt = 2LL * (H*W + W*K + K*H);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i]; long long c1 = 0;
		if (a[i] == 0)c1++; if (a[i] == H - 1)c1++;
		if (b[i] == 0)c1++; if (b[i] == W - 1)c1++;
		if (c[i] == 0)c1++; if (c[i] == K - 1)c1++;
		cnt += (3 - c1) * 2;
	}
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int S = abs(a[i] - a[j]) + abs(b[i] - b[j]) + abs(c[i] - c[j]);
			if (S == 1)cnt -= 2;
		}
	}
	cout << cnt << endl;
	return 0;
}