Example

Input

2 2 2 1
0 0 0


Output

24
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[6] = { 1,-1,0,0,0,0 };
int dy[6] = { 0,0,1,-1,0,0 };
int dz[6] = { 0,0,0,0,1,-1 };
int main() {
	map<pair<int,P>, int> mp;
	ll a, b, c; cin >> a >> b >> c;
	ll res = 2 * (a*b + b * c + c * a);
	int n; cin >> n;
	int x, y, z;
	rep(i, n) {
		cin >> x >> y >> z;
		int cnt = 0;
		rep(k, 6) {
			int nx = x + dx[k]; int ny = y + dy[k]; int nz = z + dz[k];
			if (nx < 0 || ny < 0 || nz < 0 || nx == a || ny == b || nz == c|| mp[{nx, { ny, nz }}] == 1)cnt++;
		}
		res += (ll)2 * (ll)(3 - cnt);
		mp[{x, { y, z }}] = 1;
	}
	cout << res << endl;
	return 0;
}
