#include <bits/stdc++.h>
using namespace std;
const int N = 500100;
long long AB[N], BA[N], AC[N], CA[N], BC[N], CB[N];
long long sumBC[N];
long long ans;
long long X, Y, Z;
void read() {
  int n;
  scanf("%d%lld%lld%lld", &n, &X, &Y, &Z);
  ans = X * Y * Z;
  while (n--) {
    long long x, y, z;
    scanf("%lld%lld%lld", &x, &y, &z);
    AB[x] = max(AB[x], y);
    AC[x] = max(AC[x], z);
    BA[y] = max(BA[y], x);
    BC[y] = max(BC[y], z);
    CA[z] = max(CA[z], x);
    CB[z] = max(CB[z], y);
  }
  for (long long x = X; x > 0; x--) {
    AB[x - 1] = max(AB[x - 1], AB[x]);
    AC[x - 1] = max(AC[x - 1], AC[x]);
  }
  for (long long y = Y; y > 0; y--) {
    BA[y - 1] = max(BA[y - 1], BA[y]);
    BC[y - 1] = max(BC[y - 1], BC[y]);
  }
  for (long long z = Z; z > 0; z--) {
    CA[z - 1] = max(CA[z - 1], CA[z]);
    CB[z - 1] = max(CB[z - 1], CB[z]);
  }
  for (long long y = 1; y <= Y; y++) sumBC[y] = sumBC[y - 1] + BC[y];
  return;
}
int main() {
  read();
  for (long long x = 1; x <= X; x++) {
    ans -= AB[x] * Z;
    ans -= AC[x] * Y;
  }
  for (long long y = 1; y <= Y; y++) {
    ans -= BC[y] * X;
  }
  for (long long x = 1; x <= X; x++) ans += AB[x] * AC[x];
  for (long long y = 1; y <= Y; y++) ans += BA[y] * BC[y];
  for (long long z = 1; z <= Z; z++) ans += CA[z] * CB[z];
  for (long long x = 1; x <= X; x++) {
    long long ry = AB[x], rz = AC[x];
    if (ry == 0 || rz == 0) continue;
    long long ly = CB[rz];
    ly = min(ly, ry);
    ans -= ly * rz + sumBC[ry] - sumBC[ly];
  }
  printf("%lld\n", ans);
  return 0;
}
