Example

Input

2 2 2 1
0 0 0


Output

24
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    ll a,b,c;
    int n;
    cin>>a>>b>>c>>n;
    ll ans=2*(a*b+b*c+c*a)+6*n;
    set<pair<int,P> > st;
    REP(i,n){
        int x,y,z;
        cin>>x>>y>>z;
        st.insert(make_pair(x,P(y,z)));
    }
    int dx[]={1,-1,0,0,0,0},dy[]={0,0,1,-1,0,0},dz[]= {0,0,0,0,1,-1};
    for (auto p:st){
        int x=p.first,y=p.second.first,z=p.second.second;
        REP(k,6){
            int xx=x+dx[k],yy=y+dy[k],zz=z+dz[k];
            if(xx<0||yy<0||zz<0||xx>=a||yy>=b||zz>=c)ans-=2;
            else if (st.find(make_pair(xx,P(yy,zz)))!=st.end())ans-=1;
        }
    }
    cout<<ans<<endl; 
    return 0;
}