Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef tuple<ll, ll, ll> P;

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

int main(){
	ll a, b, c, x, y, z, area, k;
	int n;
	P t;
	set<P> s;
	cin >> a >> b >> c >> n;
	area = 2 * (a * b + b * c + a * c);
	for(int i = 0;i < n;++i){
		cin >> x >> y >> z;
		k = 0;
		k += (x == 0) + (x == a - 1);
		k += (y == 0) + (y == b - 1);
		k += (z == 0) + (z == c - 1);
		for(int i = 0;i < 6;++i){
			t = make_tuple(x + dx[i], y + dy[i], z + dz[i]);
			if(s.find(t) != s.end()) ++k;
		}
		area += -k + (6 - k);
		s.insert(make_tuple(x, y, z));
	}
	cout << area << endl;
	return 0;
}

