Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int A,B,C,n;
set<PP> erased;

bool isTouchSpace(int x,int y,int z){
  if(x<0 || y<0 || z<0 || x>=A || y>=B || z>=C) return 1;
  return erased.count(PP(x,P(y,z)));
}

bool isTouchCube(int x,int y,int z){
  if(x<0 || y<0 || z<0 || x>=A || y>=B || z>=C) return 0;
  return !erased.count(PP(x,P(y,z)));
}


signed main(){
  cin>>A>>B>>C>>n;
  int ans = 2*(A*B + B*C + C*A);

  int dx[] = {1,-1,0,0,0,0};
  int dy[] = {0,0,1,-1,0,0};
  int dz[] = {0,0,0,0,1,-1};
  
  while(n--){
    int x,y,z;
    cin>>x>>y>>z;
    for(int i=0;i<6;i++){
      int nx = x+dx[i],ny = y+dy[i],nz = z+dz[i];
      ans -= isTouchSpace(nx,ny,nz);
      ans += isTouchCube(nx,ny,nz);
    }
    erased.insert(PP(x,P(y,z)));
  }
  
  cout<<ans<<endl;
  return 0;
}