Example

Input

2 2 2 1
0 0 0


Output

24
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	set<pair<int, pair<int, int>>>st;
	cin >> N >> M >> K;
	cin >> T;
	long long int ans = N * M + M * K + N * K;
	ans <<= 1;
	while (T--) {
		int a, b, c;
		cin >> a >> b >> c;
		int num = 0;
		if (a + 1 == N || st.find({ a + 1,{b,c} }) != st.end())num++;
		if (a == 0 || st.find({ a - 1,{b,c} }) != st.end())num++;
		if (b + 1 == M || st.find({ a,{ b + 1,c } }) != st.end())num++;
		if (b == 0 || st.find({ a,{ b - 1,c } }) != st.end())num++;
		if (c + 1 == K || st.find({ a,{ b,c + 1 } }) != st.end())num++;
		if (c == 0 || st.find({ a,{ b,c - 1 } }) != st.end())num++;
		ans += 6 - num * 2;
		st.insert({ a,{b,c} });
	}
	cout << ans << endl;
}
