Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll a, b, c, n;
    cin >> a >> b >> c >> n;
    vector<ll> x(n), y(n), z(n);
    REP(i, n) cin >> x[i] >> y[i] >> z[i];

    ll ret = 0;
    // x,y を固定
    {
        ll idx = 0;
        map<PII,ll> mp;
        vector<vector<ll>> v(n, vector<ll>(1, -1));
        REP(i, n) {
            if(mp.find({x[i],y[i]}) == mp.end()) {
                mp[{x[i], y[i]}] = idx++;
            }
            ll num = mp[{x[i], y[i]}];
            v[num].push_back(z[i]);
        }
        REP(i, idx) {
            sort(ALL(v[i]));
            REP(j, v[i].size()) {
                if(j==(ll)v[i].size()-1 && v[i][j]!=c-1) ret += 2;
                if(j<(ll)v[i].size()-1 && v[i][j]+1 != v[i][j+1]) ret += 2;
            }
        }
        ret += (a*b-idx)*2;
    }
    dump(ret);
    // x,z を固定
    {
        ll idx = 0;
        map<PII,ll> mp;
        vector<vector<ll>> v(n, vector<ll>(1, -1));
        REP(i, n) {
            if(mp.find({x[i],z[i]}) == mp.end()) {
                mp[{x[i], z[i]}] = idx++;
            }
            ll num = mp[{x[i], z[i]}];
            v[num].push_back(y[i]);
        }
        REP(i, idx) {
            sort(ALL(v[i]));
            REP(j, v[i].size()) {
                if(j==(ll)v[i].size()-1 && v[i][j]!=b-1) ret += 2;
                if(j<(ll)v[i].size()-1 && v[i][j]+1 != v[i][j+1]) ret += 2;
            }
        }
        ret += (a*c-idx)*2;
    }
    dump(ret);
    // y,z を固定
    {
        ll idx = 0;
        map<PII,ll> mp;
        vector<vector<ll>> v(n, vector<ll>(1, -1));
        REP(i, n) {
            if(mp.find({z[i],y[i]}) == mp.end()) {
                mp[{z[i], y[i]}] = idx++;
            }
            ll num = mp[{z[i], y[i]}];
            v[num].push_back(x[i]);
        }
        REP(i, idx) {
            sort(ALL(v[i]));
            REP(j, v[i].size()) {
                if(j==(ll)v[i].size()-1 && v[i][j]!=a-1) ret += 2;
                if(j<(ll)v[i].size()-1 && v[i][j]+1 != v[i][j+1]) ret += 2;
            }
        }
        ret += (c*b-idx)*2;
    }
    dump(ret);

    cout << ret << endl;

    return 0;
}
