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;
ll a, b, c;
bool isin(int x, int y, int z){
    return x >= 0 && y >= 0 && z >= 0 && x < a && y < b && z < c;
}
int main() {
    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 (!isin(xx,yy,zz)) ans -= 2;
            else if (st.find(make_pair(xx, P(yy, zz))) != st.end()) ans -= 1;
        }
    }
    cout << ans << endl; 
    return 0;
}