Example

Input

2 2 2 1
0 0 0


Output

24
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll a,b,c,n;
  cin>>a>>b>>c>>n;
  set<PP> st;
  ll dx[6]={1,-1,0,0,0,0};
  ll dy[6]={0,0,1,-1,0,0};
  ll dz[6]={0,0,0,0,1,-1};
  ll ans=2*(a*b+b*c+c*a);
  for(int i=0;i<n;i++){
    ll x,y,z;
    cin>>x>>y>>z;
    for(int j=0;j<6;j++){
      ll tx=x+dx[j];
      ll ty=y+dy[j];
      ll tz=z+dz[j];
      if(st.count(PP(tx,P(ty,tz)))||tx<0||a<=tx||ty<0||b<=ty||tz<0||c<=tz){
	ans--;
      }else ans++;
    }
    st.insert(PP(x,P(y,z)));
  }
  cout<<ans<<endl;
  return 0;
}

