Example

Input

2 2 2 1
0 0 0


Output

24
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

typedef tuple<ll,ll,ll> P;

#define MT make_tuple


int main(){
    ll a,b,c,n;
    cin>>a>>b>>c>>n;
    map<P,ll> cnt;
    ll ans=(a*b+b*c+c*a)*2;
    set<P> rem;
    for(int i=0;i<n;i++){
        P W;
        ll x,y,z;
        cin>>get<0>(W)>>get<1>(W)>>get<2>(W);
        x=get<0>(W);
        y=get<1>(W);
        z=get<2>(W);
        ll ct=0;
        if(x==0){ct++;}
        if(x==a-1){ct++;}
        if(y==0){ct++;}
        if(y==b-1){ct++;}
        if(z==0){ct++;}
        if(z==c-1){ct++;}
        if(cnt.count(W)){
            ct+=cnt[W];
            cnt.erase(W);
        }
        ans-=ct;
        if(x!=0 && !rem.count(MT(x-1,y,z))){cnt[MT(x-1,y,z)]++; ans++;}
        if(x!=a-1 && !rem.count(MT(x+1,y,z))){cnt[MT(x+1,y,z)]++; ans++;}
        if(y!=0 && !rem.count(MT(x,y-1,z))){cnt[MT(x,y-1,z)]++; ans++;}
        if(y!=b-1 && !rem.count(MT(x,y+1,z))){cnt[MT(x,y+1,z)]++; ans++;}
        if(z!=0 && !rem.count(MT(x,y,z-1))){cnt[MT(x,y,z-1)]++; ans++;}
        if(z!=c-1 && !rem.count(MT(x,y,z+1))){cnt[MT(x,y,z+1)]++; ans++;}
        rem.insert(W);
    }
    cout<<ans<<endl;
    
    
    return 0;
}

