Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
using namespace std;
#define int long long

typedef pair<int,int>P;
typedef pair<int,P>PP;


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

set<PP> st;

signed main(){
  int A,B,C,n;
  cin>>A>>B>>C>>n;

  int sum = A*B*2 + A*C*2 + B*C*2;
  while(n--){
    int x,y,z;
    cin>>x>>y>>z;
    for(int i=0;i<6;i++){
      int nx = x + dx[i];
      int ny = y + dy[i];
      int nz = z + dz[i];
      if(nx<0||ny<0||nz<0 || nx>=A||ny>=B||nz>=C) sum--;
      else if(st.count(PP(nx,P(ny,nz))))sum--;
      else sum++;
    }
    st.insert(PP(x,P(y,z)));
  }

  cout<< sum <<endl;
}

