#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
inline void priv(vector<int> a) {
  for (int i = 0; i < ((int)(a).size()); ++i)
    printf("%d%c", a[i], i == (int)(a).size() - 1 ? '\n' : ' ');
}
template <typename T>
istream& operator>>(istream& i, vector<T>& v) {
  for (int j = 0; j < ((int)(v).size()); ++j) i >> v[j];
  return i;
}
template <typename T>
string join(const vector<T>& v) {
  stringstream s;
  for (int i = 0; i < ((int)(v).size()); ++i) s << ' ' << v[i];
  return s.str().substr(1);
}
template <typename T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  if ((int)(v).size()) o << join(v);
  return o;
}
template <typename T1, typename T2>
istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& v) {
  return o << v.first << "," << v.second;
}
const int MX = 500005, INF = 1001001001;
const long long int LINF = 1e18;
const double eps = 1e-10;
struct cube {
  int p[3];
  cube(int x, int y, int z) {
    p[0] = x;
    p[1] = y;
    p[2] = z;
  }
  bool operator<(const cube& c) const { return p[2] > c.p[2]; }
};
vector<cube> cs;
set<pair<int, int> > ps;
long long solve() {
  ps.insert(pair<int, int>(0, 1000000001));
  ps.insert(pair<int, int>(1000000001, 0));
  long long ans = 0, pz = 0, area = 0;
  for (auto& e : cs) {
    int x = e.p[0], y = e.p[1], z = e.p[2];
    ans += (pz - z) * area;
    pz = z;
    auto lb = ps.lower_bound(pair<int, int>(x, y)), ub = lb;
    int py = lb->second, px = x;
    if (py >= y) continue;
    while (lb-- != begin(ps)) {
      int nx = lb->first, ny = lb->second;
      area += 1LL * (px - nx) * (y - py);
      if (ny > y) break;
      py = ny;
      px = nx;
    }
    ps.erase(++lb, ub);
    ps.insert(ub, pair<int, int>(x, y));
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(3);
  for (int i = 0; i < (3); ++i) scanf("%d", &a[i]);
  long long int tot = 1;
  for (int i = 0; i < (3); ++i) tot *= a[i];
  for (int i = 0; i < (n); ++i) {
    vector<int> b(3);
    for (int j = 0; j < (3); ++j) scanf("%d", &b[j]);
    for (int k = 0; k < (3); ++k) {
      vector<int> c = b;
      c[k] = a[k];
      cs.push_back(cube(c[0], c[1], c[2]));
    }
  }
  cs.push_back(cube(0, 0, 0));
  sort(cs.begin(), cs.end());
  long long int ans = tot - solve();
  cout << ans << endl;
  return 0;
}
