Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;typedef pair<ll,ll> P;typedef pair<ll,P> PP;
ll dx[6]={-1,0,0,1,0,0},dy[6]={0,-1,0,0,1,0},dz[6]={0,0,-1,0,0,1},a,b,c,n,s,t,r;
set<PP> m;
int main(){
  cin>>a>>b>>c>>n;
  ll ans=(a*b+b*c+c*a)*2;
  while(n--) {
    cin>>s>>t>>r;
    for(ll i=0;i<6;i++) {
      ll x=s+dx[i],y=t+dy[i],z=r+dz[i];
      ans+=(x<0||x>=a||y<0||y>=b||z<0||z>=c||m.count(PP(x,P(y,z))))?-1:1;
    }
    m.insert(PP(s,P(t,r)));
  }
  cout<<ans<<endl;
  return 0;
}
