#include <bits/stdc++.h>
using namespace std;
static const int MOD = 1000000007;
static const long long MODL = 1000000000000000003LL;
template <class T>
inline T MIN(const T x, const T y) {
  return (x < y) ? x : y;
}
template <class T>
inline T MAX(const T x, const T y) {
  return (x > y) ? x : y;
}
template <class T>
inline void UPDMIN(T &x, const T y) {
  if (x > y) x = y;
}
template <class T>
inline void UPDMAX(T &x, const T y) {
  if (x < y) x = y;
}
template <class T>
inline int SIZE(const T &x) {
  return (int)x.size();
}
template <class T>
inline int LENGTH(const T &x) {
  return (int)x.length();
}
template <class T1, class T2>
inline pair<T1, T2> MP(const T1 &x, const T2 &y) {
  return make_pair(x, y);
}
inline int BINT(const int x) { return 1 << x; }
inline long long BLLD(const int x) { return 1LL << x; }
inline int BINT_TEST(const int s, const int x) { return (s & BINT(x)) != 0; }
inline int BLLD_TEST(const long long s, const int x) {
  return (s & BLLD(x)) != 0LL;
}
template <class T>
inline T LOWBIT(const T x) {
  return (x ^ (x - 1)) & x;
}
template <class T>
inline int BITCOUNT(const T x) {
  return (!x) ? x : (1 + BITCOUNT(x & (x - 1)));
}
const double PI = acos(-1.0);
const double EPS = 1e-5;
template <class T>
inline T SQR(const T x) {
  return x * x;
}
template <class T1, class T2>
inline T1 POW(const T1 x, const T2 y) {
  if (!y)
    return 1;
  else if ((y & 1) == 0) {
    return SQR(POW(x, y >> 1));
  } else
    return POW(x, y ^ 1) * x;
}
template <class T>
inline T GCD(const T x, const T y) {
  if (x < 0) return GCD(-x, y);
  if (y < 0) return GCD(x, -y);
  return (!y) ? x : GCD(y, x % y);
}
template <class T>
inline T LCM(const T x, const T y) {
  if (x < 0) return LCM(-x, y);
  if (y < 0) return LCM(x, -y);
  return x * (y / GCD(x, y));
}
template <class T>
inline T EEA(const T a, const T b, T &x, T &y) {
  if (a < 0) {
    T d = EEA(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = EEA(a, -b, x, y);
    y = -y;
    return d;
  }
  if (!b) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = EEA(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <class T>
inline vector<pair<T, int> > FACTORIZE(T x) {
  vector<pair<T, int> > ret;
  if (x < 0) x = -x;
  for (T i = 2; x > 1;) {
    if (x % i == 0) {
      int count = 0;
      for (; x % i == 0; x /= i) count++;
      ret.push_back(MP(i, count));
    }
    i++;
    if (i > x / i) i = x;
  }
  return ret;
}
template <class T>
inline int ISPRIME(const T x) {
  if (x <= 1) return 0;
  for (T i = 2; SQR(i) <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
template <class T>
inline T EULARFUNCTION(T x) {
  vector<pair<T, int> > f = FACTORIZE(x);
  for (typename vector<pair<T, int> >::iterator it = f.begin(); it != f.end();
       it++) {
    x = x / it->first * (it->first - 1);
  }
  return x;
}
template <class T>
inline T INVERSEE(const T a, const T b = MOD) {
  T x, y;
  EEA(a, b, x, y);
  return x ? x : 1;
}
template <class T>
inline T MOD_STD(const T x, const T m = MOD) {
  return (x % m + m) % m;
}
template <class T>
inline void MOD_STD(T *x, const T m = MOD) {
  *x = (*x % m + m) % m;
}
template <class T>
inline T MOD_ADD(const T x, const T y, const T m = MOD) {
  return (x + y) % m;
}
template <class T>
inline void MOD_ADD(T *x, const T y, const T m = MOD) {
  *x = (*x + y) % m;
}
template <class T>
inline T MOD_MUL(const T x, const T y, const T m = MOD) {
  return (T)((1LL * x * y) % m);
}
template <class T>
inline void MOD_MUL(T *x, const T y, const T m = MOD) {
  *x = (T)((1LL * (*x) * y) % m);
}
template <class T1, class T2>
inline T1 MOD_POW(const T1 x, const T2 y, const T1 m = MOD) {
  if (y == 0)
    return 1 % m;
  else if ((y & 1) == 0) {
    T1 z = MOD_POW(x, y >> 1, m);
    return MOD_MUL(z, z, m);
  } else
    return MOD_MUL(MOD_POW(x, y ^ 1, m), x, m);
}
inline long long MODL_MUL(long long x, long long y, const long long m = MOD) {
  if (x < y) swap(x, y);
  long long z = 0LL;
  while (y > 0) {
    if (y & 1) {
      MOD_ADD(&z, x, m);
    }
    MOD_ADD(&x, x, m);
    y >>= 1;
  }
  return z;
}
inline long long MODL_POW(const long long x, const long long y,
                          const long long m = MOD) {
  if (y == 0LL)
    return 1LL % m;
  else if ((y & 1) == 0LL) {
    long long z = MODL_POW(x, y >> 1, m);
    return MODL_MUL(z, z, m);
  } else
    return MODL_MUL(MODL_POW(x, y ^ 1, m), x, m);
}
template <class T>
class MATX {
 private:
  unsigned long hig, wid;
  T *data;
  void __init() {
    this->data = (T *)malloc(sizeof(T) * this->hig * this->wid);
    memset(this->data, 0, sizeof(T) * this->hig * this->wid);
  }

 public:
  MATX() {
    this->hig = this->wid = 1;
    __init();
  }
  MATX(const unsigned long _len) {
    this->hig = this->wid = _len;
    __init();
  }
  MATX(const unsigned long _hig, const unsigned long _wid) {
    this->hig = _hig;
    this->wid = _wid;
    __init();
  }
  MATX(const MATX &rhs) {
    this->hig = rhs.hig;
    this->wid = rhs.wid;
    this->data = (T *)malloc(sizeof(T) * this->hig * this->wid);
    for (unsigned long x = 0; x < this->hig; x++)
      for (unsigned long y = 0; y < this->wid; y++)
        this->data[x * this->wid + y] = rhs.at(x, y);
  }
  ~MATX() { free(this->data); }
  T &operator()(const unsigned long x, const unsigned long y) {
    if (x >= this->hig || y >= this->wid) return (*(T *)NULL);
    return this->data[x * wid + y];
  }
  MATX &operator=(const MATX &rhs) {
    if (this->hig != rhs.hig || this->wid != rhs.wid) {
      free(this->data);
      this->hig = rhs.hig;
      this->wid = rhs.wid;
      this->data = (T *)malloc(sizeof(T) * this->hig * this->wid);
    }
    for (unsigned long x = 0; x < this->hig; x++)
      for (unsigned long y = 0; y < this->wid; y++)
        this->data[x * this->wid + y] = rhs.at(x, y);
    return *this;
  }
  const MATX operator+(const MATX &opn) const {
    MATX ret(*this);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        ret.data[x * ret.wid + y] += opn.at(x, y);
    return ret;
  }
  const MATX operator-(const MATX &opn) const {
    MATX ret(*this);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        ret.data[x * ret.wid + y] -= opn.at(x, y);
    return ret;
  }
  const MATX operator*(const MATX &opn) const {
    MATX ret(this->hig, opn.wid);
    const unsigned long len = MIN(this->wid, opn.hig);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        for (unsigned long z = 0; z < len; z++)
          ret.data[x * ret.wid + y] += this->at(x, z) * opn.at(z, y);
    return ret;
  }
  const MATX mul(const MATX &opn) const { return *this * opn; }
  template <class T2>
  const MATX mul(const MATX &opn, const T2 m) const {
    MATX ret(this->hig, opn.wid);
    const unsigned long len = MIN(this->wid, opn.wid);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        for (unsigned long z = 0; z < len; z++)
          MOD_ADD(&ret.data[x * ret.wid + y],
                  MOD_MUL(this->at(x, z), opn.at(z, y), m), m);
    return ret;
  }
  MATX &operator+=(const MATX &rhs) {
    *this = *this + rhs;
    return *this;
  }
  MATX &operator-=(const MATX &rhs) {
    *this = *this - rhs;
    return *this;
  }
  MATX &operator*=(const MATX &rhs) {
    *this = *this * rhs;
    return *this;
  }
  const MATX pow(const unsigned long p) const {
    MATX buff(*this), ret(this->hig, this->wid);
    ret.set_one();
    if (p > 0)
      for (unsigned long i = 1;; i <<= 1) {
        if (p & i) ret *= buff;
        buff *= buff;
        if (i > (p >> 1)) break;
      }
    return ret;
  }
  template <class T2>
  const MATX pow(const unsigned long p, const T2 m) const {
    MATX buff(*this), ret(this->hig, this->wid);
    ret.set_one();
    if (p > 0)
      for (unsigned long i = 1;; i <<= 1) {
        if (p & i) ret = ret.mul(buff, m);
        buff = buff.mul(buff, m);
        if (i > (p >> 1)) break;
      }
    return ret;
  }
  const T at(const unsigned long x, const unsigned long y) const {
    if (x >= this->hig || y >= this->wid) return 0;
    return this->data[x * wid + y];
  }
  void show() const {
    for (unsigned long x = 0; x < this->hig; x++) {
      for (unsigned long y = 0; y < this->wid; y++)
        cout << this->at(x, y) << " ";
      cout << endl;
    }
  }
  void set_one() {
    for (unsigned long x = 0; x < this->hig; x++)
      for (unsigned long y = 0; y < this->wid; y++)
        this->data[x * this->wid + y] = (x == y) ? 1 : 0;
  }
};
template <class T>
class Complex {
 public:
  T r, i;
  Complex(T x = 0.0, T y = 0.0) {
    this->r = x;
    this->i = y;
  }
  Complex operator+(const Complex &opn) const {
    return Complex(this->r + opn.r, this->i + opn.i);
  }
  Complex operator-(const Complex &opn) const {
    return Complex(this->r - opn.r, this->i - opn.i);
  }
  Complex operator*(const Complex &opn) const {
    return Complex(this->r * opn.r - this->i * opn.i,
                   this->r * opn.i + this->i * opn.r);
  }
};
class MILLERRABIN {
 private:
  static const int prime_table[12];
  int witness(long long a, long long d, long long s, long long n) {
    long long r = MODL_POW(a, d, n);
    if (r == 1 || r == n - 1) return 0;
    for (int i = 0; i < s - 1; i++) {
      r = MODL_MUL(r, r, n);
      if (r == 1) return 1;
      if (r == n - 1) return 0;
    }
    return 1;
  }

 public:
  int test(const long long n) {
    if (n <= 2LL) return 0;
    long long p = n - 1LL, s = 0LL;
    while (!(p & 1)) {
      p >>= 1;
      s++;
    }
    for (int i = 0; i < 12 && this->prime_table[i] < n; i++) {
      if (witness(this->prime_table[i], p, s, n)) return 0;
    }
    return 1;
  }
};
const int MILLERRABIN::prime_table[12] = {2,  3,  5,  7,  11, 13,
                                          17, 19, 23, 29, 31, 37};
const int inf = 0x3f3f3f3f;
class point_t {
 public:
  long long val;
  int idx;
  point_t(const long long lhs = 0LL, const int rhs = 0) {
    this->val = lhs;
    this->idx = rhs;
  }
  bool operator<(const point_t &rhs) const {
    if (this->val != rhs.val) return this->val > rhs.val;
    return this->idx < rhs.idx;
  }
} a[110000];
int n, bst;
long long cc, cf, cm, m;
long long buf[110000], pre[110000];
long long ans[110000], res;
int able(const long long cap, const long long cst, const int cnt) {
  int lef = cnt, rig = n - 1;
  while (lef <= rig) {
    int mid = (lef + rig) >> 1;
    if (a[mid].val < cap) {
      if (mid == lef || a[mid - 1].val >= cap) {
        return buf[mid] + (cap - a[mid].val) * (n - mid) <= cst;
      }
      rig = mid - 1;
    } else
      lef = mid + 1;
  }
  return 1;
}
long long core_entry(const int cnt, const int flag) {
  long long cst = m, cur = cnt * cf;
  cst -= pre[cnt];
  if (cst < 0LL) return -inf;
  if (cnt == n) {
    cur += cc * cm;
    if (flag) {
      for (int i = 0; i < cnt; i++) ans[a[i].idx] = cc;
      for (int i = cnt; i < n; i++) {
        ans[a[i].idx] = a[i].val;
      }
    } else {
      if (res < cur) {
        res = cur;
        bst = cnt;
      }
    }
    return cur;
  }
  long long lef = a[n - 1].val, rig = cc - 1LL;
  while (lef <= rig) {
    long long mid = (lef + rig) >> 1;
    if (able(mid, cst, cnt)) {
      if (mid == rig || !able(mid + 1LL, cst, cnt)) {
        cur += mid * cm;
        if (flag) {
          for (int i = 0; i < cnt; i++) ans[a[i].idx] = cc;
          for (int i = cnt; i < n; i++) {
            if (cm > 0LL && a[i].val < mid)
              ans[a[i].idx] = mid;
            else
              ans[a[i].idx] = a[i].val;
          }
        } else {
          if (res < cur) {
            res = cur;
            bst = cnt;
          }
        }
        return cur;
      }
      lef = mid + 1;
    } else
      rig = mid - 1;
  }
  return -inf;
}
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n >> cc >> cf >> cm >> m) {
    for (int i = 0; i < n; i++) {
      cin >> a[i].val;
      a[i].idx = i;
    }
    sort(a, a + n);
    buf[n - 1] = 0LL;
    for (int i = n - 2; i >= 0; i--) {
      buf[i] = buf[i + 1] + (a[i].val - a[i + 1].val) * (n - i - 1);
    }
    pre[0] = 0;
    for (int i = 1; i <= n; i++) {
      pre[i] = pre[i - 1] + cc - a[i - 1].val;
    }
    res = -1LL;
    int cnt = 0;
    while (cnt < n && a[cnt].val == cc) cnt++;
    for (int i = cnt; i <= n; i++) {
      core_entry(i, 0);
    }
    core_entry(bst, 1);
    cout << res << endl;
    for (int i = 0; i < n; i++) {
      if (i) cout << " ";
      cout << ans[i];
    }
    cout << endl;
  }
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-negative integer ai — the current skill level. All skills have the same maximum level A.

Along with the skills, global ranking of all players was added. Players are ranked according to the so-called Force. The Force of a player is the sum of the following values:

  * The number of skills that a character has perfected (i.e., such that ai = A), multiplied by coefficient cf.
  * The minimum skill level among all skills (min ai), multiplied by coefficient cm. 



Now Lesha has m hacknetian currency units, which he is willing to spend. Each currency unit can increase the current level of any skill by 1 (if it's not equal to A yet). Help him spend his money in order to achieve the maximum possible value of the Force.

Input

The first line of the input contains five space-separated integers n, A, cf, cm and m (1 ≤ n ≤ 100 000, 1 ≤ A ≤ 109, 0 ≤ cf, cm ≤ 1000, 0 ≤ m ≤ 1015).

The second line contains exactly n integers ai (0 ≤ ai ≤ A), separated by spaces, — the current levels of skills.

Output

On the first line print the maximum value of the Force that the character can achieve using no more than m currency units.

On the second line print n integers a'i (ai ≤ a'i ≤ A), skill levels which one must achieve in order to reach the specified value of the Force, while using no more than m currency units. Numbers should be separated by spaces.

Examples

Input

3 5 10 1 5
1 3 1


Output

12
2 5 2 


Input

3 5 10 1 339
1 3 1


Output

35
5 5 5 

Note

In the first test the optimal strategy is to increase the second skill to its maximum, and increase the two others by 1.

In the second test one should increase all skills to maximum.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
static const int MOD = 1000000007;
static const long long MODL = 1000000000000000003LL;
template <class T>
inline T MIN(const T x, const T y) {
  return (x < y) ? x : y;
}
template <class T>
inline T MAX(const T x, const T y) {
  return (x > y) ? x : y;
}
template <class T>
inline void UPDMIN(T &x, const T y) {
  if (x > y) x = y;
}
template <class T>
inline void UPDMAX(T &x, const T y) {
  if (x < y) x = y;
}
template <class T>
inline int SIZE(const T &x) {
  return (int)x.size();
}
template <class T>
inline int LENGTH(const T &x) {
  return (int)x.length();
}
template <class T1, class T2>
inline pair<T1, T2> MP(const T1 &x, const T2 &y) {
  return make_pair(x, y);
}
inline int BINT(const int x) { return 1 << x; }
inline long long BLLD(const int x) { return 1LL << x; }
inline int BINT_TEST(const int s, const int x) { return (s & BINT(x)) != 0; }
inline int BLLD_TEST(const long long s, const int x) {
  return (s & BLLD(x)) != 0LL;
}
template <class T>
inline T LOWBIT(const T x) {
  return (x ^ (x - 1)) & x;
}
template <class T>
inline int BITCOUNT(const T x) {
  return (!x) ? x : (1 + BITCOUNT(x & (x - 1)));
}
const double PI = acos(-1.0);
const double EPS = 1e-5;
template <class T>
inline T SQR(const T x) {
  return x * x;
}
template <class T1, class T2>
inline T1 POW(const T1 x, const T2 y) {
  if (!y)
    return 1;
  else if ((y & 1) == 0) {
    return SQR(POW(x, y >> 1));
  } else
    return POW(x, y ^ 1) * x;
}
template <class T>
inline T GCD(const T x, const T y) {
  if (x < 0) return GCD(-x, y);
  if (y < 0) return GCD(x, -y);
  return (!y) ? x : GCD(y, x % y);
}
template <class T>
inline T LCM(const T x, const T y) {
  if (x < 0) return LCM(-x, y);
  if (y < 0) return LCM(x, -y);
  return x * (y / GCD(x, y));
}
template <class T>
inline T EEA(const T a, const T b, T &x, T &y) {
  if (a < 0) {
    T d = EEA(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = EEA(a, -b, x, y);
    y = -y;
    return d;
  }
  if (!b) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = EEA(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <class T>
inline vector<pair<T, int> > FACTORIZE(T x) {
  vector<pair<T, int> > ret;
  if (x < 0) x = -x;
  for (T i = 2; x > 1;) {
    if (x % i == 0) {
      int count = 0;
      for (; x % i == 0; x /= i) count++;
      ret.push_back(MP(i, count));
    }
    i++;
    if (i > x / i) i = x;
  }
  return ret;
}
template <class T>
inline int ISPRIME(const T x) {
  if (x <= 1) return 0;
  for (T i = 2; SQR(i) <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
template <class T>
inline T EULARFUNCTION(T x) {
  vector<pair<T, int> > f = FACTORIZE(x);
  for (typename vector<pair<T, int> >::iterator it = f.begin(); it != f.end();
       it++) {
    x = x / it->first * (it->first - 1);
  }
  return x;
}
template <class T>
inline T INVERSEE(const T a, const T b = MOD) {
  T x, y;
  EEA(a, b, x, y);
  return x ? x : 1;
}
template <class T>
inline T MOD_STD(const T x, const T m = MOD) {
  return (x % m + m) % m;
}
template <class T>
inline void MOD_STD(T *x, const T m = MOD) {
  *x = (*x % m + m) % m;
}
template <class T>
inline T MOD_ADD(const T x, const T y, const T m = MOD) {
  return (x + y) % m;
}
template <class T>
inline void MOD_ADD(T *x, const T y, const T m = MOD) {
  *x = (*x + y) % m;
}
template <class T>
inline T MOD_MUL(const T x, const T y, const T m = MOD) {
  return (T)((1LL * x * y) % m);
}
template <class T>
inline void MOD_MUL(T *x, const T y, const T m = MOD) {
  *x = (T)((1LL * (*x) * y) % m);
}
template <class T1, class T2>
inline T1 MOD_POW(const T1 x, const T2 y, const T1 m = MOD) {
  if (y == 0)
    return 1 % m;
  else if ((y & 1) == 0) {
    T1 z = MOD_POW(x, y >> 1, m);
    return MOD_MUL(z, z, m);
  } else
    return MOD_MUL(MOD_POW(x, y ^ 1, m), x, m);
}
inline long long MODL_MUL(long long x, long long y, const long long m = MOD) {
  if (x < y) swap(x, y);
  long long z = 0LL;
  while (y > 0) {
    if (y & 1) {
      MOD_ADD(&z, x, m);
    }
    MOD_ADD(&x, x, m);
    y >>= 1;
  }
  return z;
}
inline long long MODL_POW(const long long x, const long long y,
                          const long long m = MOD) {
  if (y == 0LL)
    return 1LL % m;
  else if ((y & 1) == 0LL) {
    long long z = MODL_POW(x, y >> 1, m);
    return MODL_MUL(z, z, m);
  } else
    return MODL_MUL(MODL_POW(x, y ^ 1, m), x, m);
}
template <class T>
class MATX {
 private:
  unsigned long hig, wid;
  T *data;
  void __init() {
    this->data = (T *)malloc(sizeof(T) * this->hig * this->wid);
    memset(this->data, 0, sizeof(T) * this->hig * this->wid);
  }

 public:
  MATX() {
    this->hig = this->wid = 1;
    __init();
  }
  MATX(const unsigned long _len) {
    this->hig = this->wid = _len;
    __init();
  }
  MATX(const unsigned long _hig, const unsigned long _wid) {
    this->hig = _hig;
    this->wid = _wid;
    __init();
  }
  MATX(const MATX &rhs) {
    this->hig = rhs.hig;
    this->wid = rhs.wid;
    this->data = (T *)malloc(sizeof(T) * this->hig * this->wid);
    for (unsigned long x = 0; x < this->hig; x++)
      for (unsigned long y = 0; y < this->wid; y++)
        this->data[x * this->wid + y] = rhs.at(x, y);
  }
  ~MATX() { free(this->data); }
  T &operator()(const unsigned long x, const unsigned long y) {
    if (x >= this->hig || y >= this->wid) return (*(T *)NULL);
    return this->data[x * wid + y];
  }
  MATX &operator=(const MATX &rhs) {
    if (this->hig != rhs.hig || this->wid != rhs.wid) {
      free(this->data);
      this->hig = rhs.hig;
      this->wid = rhs.wid;
      this->data = (T *)malloc(sizeof(T) * this->hig * this->wid);
    }
    for (unsigned long x = 0; x < this->hig; x++)
      for (unsigned long y = 0; y < this->wid; y++)
        this->data[x * this->wid + y] = rhs.at(x, y);
    return *this;
  }
  const MATX operator+(const MATX &opn) const {
    MATX ret(*this);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        ret.data[x * ret.wid + y] += opn.at(x, y);
    return ret;
  }
  const MATX operator-(const MATX &opn) const {
    MATX ret(*this);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        ret.data[x * ret.wid + y] -= opn.at(x, y);
    return ret;
  }
  const MATX operator*(const MATX &opn) const {
    MATX ret(this->hig, opn.wid);
    const unsigned long len = MIN(this->wid, opn.hig);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        for (unsigned long z = 0; z < len; z++)
          ret.data[x * ret.wid + y] += this->at(x, z) * opn.at(z, y);
    return ret;
  }
  const MATX mul(const MATX &opn) const { return *this * opn; }
  template <class T2>
  const MATX mul(const MATX &opn, const T2 m) const {
    MATX ret(this->hig, opn.wid);
    const unsigned long len = MIN(this->wid, opn.wid);
    for (unsigned long x = 0; x < ret.hig; x++)
      for (unsigned long y = 0; y < ret.wid; y++)
        for (unsigned long z = 0; z < len; z++)
          MOD_ADD(&ret.data[x * ret.wid + y],
                  MOD_MUL(this->at(x, z), opn.at(z, y), m), m);
    return ret;
  }
  MATX &operator+=(const MATX &rhs) {
    *this = *this + rhs;
    return *this;
  }
  MATX &operator-=(const MATX &rhs) {
    *this = *this - rhs;
    return *this;
  }
  MATX &operator*=(const MATX &rhs) {
    *this = *this * rhs;
    return *this;
  }
  const MATX pow(const unsigned long p) const {
    MATX buff(*this), ret(this->hig, this->wid);
    ret.set_one();
    if (p > 0)
      for (unsigned long i = 1;; i <<= 1) {
        if (p & i) ret *= buff;
        buff *= buff;
        if (i > (p >> 1)) break;
      }
    return ret;
  }
  template <class T2>
  const MATX pow(const unsigned long p, const T2 m) const {
    MATX buff(*this), ret(this->hig, this->wid);
    ret.set_one();
    if (p > 0)
      for (unsigned long i = 1;; i <<= 1) {
        if (p & i) ret = ret.mul(buff, m);
        buff = buff.mul(buff, m);
        if (i > (p >> 1)) break;
      }
    return ret;
  }
  const T at(const unsigned long x, const unsigned long y) const {
    if (x >= this->hig || y >= this->wid) return 0;
    return this->data[x * wid + y];
  }
  void show() const {
    for (unsigned long x = 0; x < this->hig; x++) {
      for (unsigned long y = 0; y < this->wid; y++)
        cout << this->at(x, y) << " ";
      cout << endl;
    }
  }
  void set_one() {
    for (unsigned long x = 0; x < this->hig; x++)
      for (unsigned long y = 0; y < this->wid; y++)
        this->data[x * this->wid + y] = (x == y) ? 1 : 0;
  }
};
template <class T>
class Complex {
 public:
  T r, i;
  Complex(T x = 0.0, T y = 0.0) {
    this->r = x;
    this->i = y;
  }
  Complex operator+(const Complex &opn) const {
    return Complex(this->r + opn.r, this->i + opn.i);
  }
  Complex operator-(const Complex &opn) const {
    return Complex(this->r - opn.r, this->i - opn.i);
  }
  Complex operator*(const Complex &opn) const {
    return Complex(this->r * opn.r - this->i * opn.i,
                   this->r * opn.i + this->i * opn.r);
  }
};
class MILLERRABIN {
 private:
  static const int prime_table[12];
  int witness(long long a, long long d, long long s, long long n) {
    long long r = MODL_POW(a, d, n);
    if (r == 1 || r == n - 1) return 0;
    for (int i = 0; i < s - 1; i++) {
      r = MODL_MUL(r, r, n);
      if (r == 1) return 1;
      if (r == n - 1) return 0;
    }
    return 1;
  }

 public:
  int test(const long long n) {
    if (n <= 2LL) return 0;
    long long p = n - 1LL, s = 0LL;
    while (!(p & 1)) {
      p >>= 1;
      s++;
    }
    for (int i = 0; i < 12 && this->prime_table[i] < n; i++) {
      if (witness(this->prime_table[i], p, s, n)) return 0;
    }
    return 1;
  }
};
const int MILLERRABIN::prime_table[12] = {2,  3,  5,  7,  11, 13,
                                          17, 19, 23, 29, 31, 37};
const int inf = 0x3f3f3f3f;
class point_t {
 public:
  long long val;
  int idx;
  point_t(const long long lhs = 0LL, const int rhs = 0) {
    this->val = lhs;
    this->idx = rhs;
  }
  bool operator<(const point_t &rhs) const {
    if (this->val != rhs.val) return this->val > rhs.val;
    return this->idx < rhs.idx;
  }
} a[110000];
int n, bst;
long long cc, cf, cm, m;
long long buf[110000], pre[110000];
long long ans[110000], res;
int able(const long long cap, const long long cst, const int cnt) {
  int lef = cnt, rig = n - 1;
  while (lef <= rig) {
    int mid = (lef + rig) >> 1;
    if (a[mid].val < cap) {
      if (mid == lef || a[mid - 1].val >= cap) {
        return buf[mid] + (cap - a[mid].val) * (n - mid) <= cst;
      }
      rig = mid - 1;
    } else
      lef = mid + 1;
  }
  return 1;
}
long long core_entry(const int cnt, const int flag) {
  long long cst = m, cur = cnt * cf;
  cst -= pre[cnt];
  if (cst < 0LL) return -inf;
  if (cnt == n) {
    cur += cc * cm;
    if (flag) {
      for (int i = 0; i < cnt; i++) ans[a[i].idx] = cc;
      for (int i = cnt; i < n; i++) {
        ans[a[i].idx] = a[i].val;
      }
    } else {
      if (res < cur) {
        res = cur;
        bst = cnt;
      }
    }
    return cur;
  }
  long long lef = a[n - 1].val, rig = cc - 1LL;
  while (lef <= rig) {
    long long mid = (lef + rig) >> 1;
    if (able(mid, cst, cnt)) {
      if (mid == rig || !able(mid + 1LL, cst, cnt)) {
        cur += mid * cm;
        if (flag) {
          for (int i = 0; i < cnt; i++) ans[a[i].idx] = cc;
          for (int i = cnt; i < n; i++) {
            if (cm > 0LL && a[i].val < mid)
              ans[a[i].idx] = mid;
            else
              ans[a[i].idx] = a[i].val;
          }
        } else {
          if (res < cur) {
            res = cur;
            bst = cnt;
          }
        }
        return cur;
      }
      lef = mid + 1;
    } else
      rig = mid - 1;
  }
  return -inf;
}
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n >> cc >> cf >> cm >> m) {
    for (int i = 0; i < n; i++) {
      cin >> a[i].val;
      a[i].idx = i;
    }
    sort(a, a + n);
    buf[n - 1] = 0LL;
    for (int i = n - 2; i >= 0; i--) {
      buf[i] = buf[i + 1] + (a[i].val - a[i + 1].val) * (n - i - 1);
    }
    pre[0] = 0;
    for (int i = 1; i <= n; i++) {
      pre[i] = pre[i - 1] + cc - a[i - 1].val;
    }
    res = -1LL;
    int cnt = 0;
    while (cnt < n && a[cnt].val == cc) cnt++;
    for (int i = cnt; i <= n; i++) {
      core_entry(i, 0);
    }
    core_entry(bst, 1);
    cout << res << endl;
    for (int i = 0; i < n; i++) {
      if (i) cout << " ";
      cout << ans[i];
    }
    cout << endl;
  }
}

```