Example

Input

2 2 2 1
0 0 0


Output

24
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

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

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int A, B, C, N;
  cin >> A >> B >> C >> N;
  vector<tuple<int, int, int> > ps;
  rep(i, N) {
    int x, y, z;
    cin >> x >> y >> z;
    ps.emplace_back(x, y, z);
  }

  map<tuple<int, int, int>, int> mp;
  int ans = 2 * (A*B + B*C + C*A);
  for(auto p : ps) {
    int x, y, z;
    tie(x, y, z) = p;
    mp[p] = 1;
    rep(i, 6) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      int nz = z + dz[i];
      if(nx < 0 || A <= nx|| ny < 0 || B <= ny|| nz < 0 || C <= nz) ans--;
      else if(mp.count(make_tuple(nx, ny, nz))) ans--;
      else ans++;
    }
  }
  cout << ans << endl;

  return 0;
}