Example

Input

2 2 2 1
0 0 0


Output

24

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <utility>
#define llint long long
#define mod 1000000007
#define inf 1e18

using namespace std;
typedef pair<llint, pair<llint, llint> > T;

llint a, b, c, n;
llint dx[] = {0, 0, -1, 1, 0, 0}, dy[] = {-1, 1, 0, 0, 0, 0}, dz[] = {0, 0, 0, 0, -1, 1};
set<T> S;

int main(void)
{

    cin >> a >> b >> c >> n;
    llint ans = a*b+b*c+c*a;
    ans *= 2;
    llint x, y, z;
    for(int i = 1; i <= n; i++){
      cin >> x >> y >> z;
      for(int j = 0; j < 6; j++){
        llint nx = x + dx[j], ny = y + dy[j], nz = z + dz[j];
        if(nx < 0 || nx >= a || ny < 0 || ny >= b || nz < 0 || nz >= c || S.count(T(nx, make_pair(ny, nz)))) ans--;
        else ans++;
        S.insert(T(x, make_pair(y, z)));
      }
    }
    cout << ans << endl;

  return 0;
}

