Example

Input

2 2 2 1
0 0 0


Output

24
#include<cstdio>
using namespace std;
typedef long long int ll;
static const int MAX_N = 1000;

ll A, B, C; int N;
int x[MAX_N], y[MAX_N], z[MAX_N];

int main(){
	scanf("%lld %lld %lld %d", &A, &B, &C, &N);
	for(int i = 0; i < N; i++) scanf("%d %d %d", &x[i], &y[i], &z[i]);
	ll res = 2 * (A * B + B * C + C * A);
	for(int i = 0; i < N; i++){
		int cnt = 6;
		if(x[i] == 0) cnt -= 2;
		if(y[i] == 0) cnt -= 2;
		if(z[i] == 0) cnt -= 2;
		if(x[i] == A - 1) cnt -= 2;
		if(y[i] == B - 1) cnt -= 2;
		if(z[i] == C - 1) cnt -= 2;
		for(int j = i + 1; j < N; j++){
			if(x[j] == x[i] + 1 && y[j] == y[i] && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] - 1 && y[j] == y[i] && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] + 1 && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] - 1 && z[j] == z[i]) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] && z[j] == z[i] + 1) cnt -= 2;
			if(x[j] == x[i] && y[j] == y[i] && z[j] == z[i] - 1) cnt -= 2;
		}
		res += cnt;
	}
	printf("%lld\n", res);
	return 0;
}

