Example

Input

2 2 2 1
0 0 0


Output

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

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

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    int n;
    cin>>n;
    vector<int> x(n),y(n),z(n);
    for(int i=0;i<n;i++) cin>>x[i]>>y[i]>>z[i];

    set<tuple<int,int,int>> s;

    auto isSpace=[&](int xp,int yp,int zp){
        if(!(0<=xp && xp<a && 0<=yp && yp<b && 0<=zp && zp<c)) return true;
        return bool(s.count(make_tuple(xp,yp,zp)));
    };
    ll res=(a*b+b*c+c*a)*2;
    for(int i=0;i<n;i++){
        for(int j=0;j<6;j++){
            int tox=x[i]+dx[j],toy=y[i]+dy[j],toz=z[i]+dz[j];
            if(isSpace(tox,toy,toz)){
                res--;
            }
            else{
                res++;
            }
            
        }
        s.insert(make_tuple(x[i],y[i],z[i]));
    }
    cout<<res<<endl;

    return 0;
}
