Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

unordered_map<int, unordered_map<int, unordered_map<int, int>>> ex;

const int dx[] = { 1, -1, 0, 0, 0, 0 };
const int dy[] = { 0, 0, 1, -1, 0, 0 };
const int dz[] = { 0, 0, 0, 0, 1, -1 };

ll A, B, C;

void del(int x, int y, int z) {
	ex[x][y][z] = 1;
}

bool find(int x, int y, int z) {
	if (x < 0 || A <= x) return false;
	if (y < 0 || B <= y) return false;
	if (z < 0 || C <= z) return false;
	return !ex[x][y].count(z);
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int N;
	cin >> A >> B >> C >> N;
	ll res = A * B * 2 + B * C * 2 + C * A * 2;
	while (N--) {
		int x, y, z;
		cin >> x >> y >> z;
		int c0 = 0, c1 = 0;
		for (int i = 0; i < 6; i++) {
			(find(x + dx[i], y + dy[i], z + dz[i]) ? c1 : c0) += 1;
		}
		res += c1 - c0;
		del(x, y, z);
	}
	cout << res << endl;
	return 0;
}

