Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

using ll = long long;
using point = tuple<ll, ll, ll>;

set<point> used;

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


int main(void) {
	ll a, b, c, n;
	cin >> a >> b >> c >> n;

	ll ans = 2LL * (a * b + b * c + c * a);

	rep(i, n) {
		ll x, y, z;
		cin >> x >> y >> z;

		ll cnt = 0LL;

		rep(j, 6) {
			const int nx = x + dx[j];
			const int ny = y + dy[j];
			const int nz = z + dz[j];

			if (nx < 0 or a <= nx or ny < 0 or b <= ny or nz < 0 or c <= nz ) continue;
			if(used.find(point(nx,ny,nz)) != end(used)) continue;
			cnt++;
		}

		ans += cnt;
		ans -= 6LL - cnt;

		used.insert(point(x, y, z));
	}

	cout << ans << endl;
}