Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define MAX_N 40
#define INF 1000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll a, b, c, n;
ll ans;
set<tuple<ll,ll,ll>> s;

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};

int main(){
    cin >> a >> b >> c >> n;
    ans = 2*a*b+2*b*c+2*c*a;
    rep(i,n){
        ll x, y, z;
        cin >> x >> y >> z;
        ll add = 6;
        rep(j,6){
            ll nx = x+dx[j], ny = y+dy[j], nz = z+dz[j];
            if(0>nx||nx>=a||0>ny||ny>=b||0>nz||nz>=c){
                add -= 2;
            } else if(s.count(make_tuple(nx,ny,nz))){
                add -= 2;
            }
        }
        ans += add;
        s.insert(make_tuple(x,y,z));
    }
    cout << ans << endl;
}