Example

Input

2 2 2 1
0 0 0


Output

24
#include <iostream>
#define int long long
using namespace std;

int a, b, c, n;
int x[1000], y[1000], z[1000];
int dx[6] = {1, 0, 0, -1, 0, 0};
int dy[6] = {0, 1, 0, 0, -1, 0};
int dz[6] = {0, 0, 1, 0, 0, -1};

bool isEscaped(int px, int py, int pz, int i) {
	if (px < 0 || py < 0 || pz < 0 || px >= a || py >= b || pz >= c) return true;
	for (int j = 0; j < i; j++) {
		if (px == x[j] && py == y[j] && pz == z[j]) {
			return true;
		}
	}
	return false;
}

signed main() {
	int i, j;
	int ans = 0;
	
	cin >> a >> b >> c >> n;
	for (i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> z[i];
		
		int cnt = 0;
		for (j = 0; j < 6; j++) {
			int px = x[i] + dx[j];
			int py = y[i] + dy[j];
			int pz = z[i] + dz[j];
			if (isEscaped(px, py, pz, i)) {
				cnt++;
			}
		}
		ans += 6 - cnt * 2;
	}
	ans += 2 * (a * b + b * c + c * a);
	
	cout << ans << endl;
	return 0;
}