Example

Input

2 2 2 1
0 0 0


Output

24
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(int arg_x,int arg_y,int arg_z){
		x = arg_x;
		y = arg_y;
		z = arg_z;
	}
	int x,y,z;
};

int diff_x[6] = {1,-1,0,0,0,0},diff_y[6]={0,0,1,-1,0,0},diff_z[6] = {0,0,0,0,1,-1};

int main(){

	ll A,B,C;
	int N;

	scanf("%lld %lld %lld %d",&A,&B,&C,&N);

	ll ans = 2*(A*B+B*C+C*A);

	vector<Info> V;
	int x,y,z,adj_x,adj_y,adj_z,adj_removed_num;

	for(int i = 0; i < N; i++){
		scanf("%d %d %d",&x,&y,&z);

		adj_removed_num = 0;

		for(int p = 0; p < 6; p++){
			adj_x = x+diff_x[p];
			adj_y = y+diff_y[p];
			adj_z = z+diff_z[p];
			if(adj_x < 0 || adj_y < 0 || adj_z < 0 || adj_x >= A || adj_y >= B || adj_z >= C){
				adj_removed_num++;
			}else{
				for(int k = 0; k < V.size();k++){
					if(V[k].x == adj_x && V[k].y == adj_y && V[k].z == adj_z)adj_removed_num++;
				}
			}
		}
		ans += 6-2*adj_removed_num;
		V.push_back(Info(x,y,z));
	}

	printf("%lld\n",ans);

	return 0;
}