#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    int x = arr[1].first;
    sort(arr+1,arr+n+1);
    int y = arr[1].first;
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
            if (x == 970106642)
            {
                cout << andis << " <- this is andis\n";
                cout << mi << " <- minim\n";
                cout << y << "\n";
                cout << redu << "\n";
            }
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    num = v[0];
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    if (finalans == 45348016)
        cout << andis << " ";
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0];
    int ch = 0;
    redu = - 1;
    num = v[0];
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    if (finalans == 45348016)
        cout << andis << " ";
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    int x = arr[1].first;
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
            if (x == 970106642)
            {
                cout << andis << " <- this is andis\n";
                cout << mi << " <- minim\n";
                cout << now << "\n";
                cout << redu << "\n";
            }
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    num = v[0];
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            if (arr[1].first == 970106642)
            {
                cout << andis << " <- this is andis\n";
                cout << mi << " <- minim\n";
                cout << now << "\n";
                cout << redu << "\n";
            }
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    int x = arr[1].first;
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
            if (x == 970106642)
            {
               /* cout << andis << " <- this is andis\n";
                cout << mi << " <- minim\n";
                cout << y << "\n";
                cout << redu << "\n";*/
                int atthe = 0;
                for (int i=0 ; i<n ; i++)
                {
                    if (v[i] < 62896)
                        atthe += 62896 - v[i];
                }
                cout << atthe << " <- may negative";
            }
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    int x = arr[1].first;
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            if (x == 970106642)
            {
                cout << andis << " <- this is andis\n";
                cout << mi << " <- minim\n";
                cout << now << "\n";
                cout << redu << "\n";
            }
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = -1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch > 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    num = v[0];
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    if (finalans == 45348016)
        cout << andis << " ";
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = -1;
    int ch = 0;
    redu = - 1;
    num = v[0];
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int maxix = 100*1001;
pair <int,int> arr[maxix];
int ans[maxix];
int par[maxix];
vector <int> v;
int n, A, cf, cm, m;
int num, redu;
void minim(int index, int now)
{
    int r = A + 1;
    int l = v[0] - 1;
    int ch = 0;
    redu = - 1;
    while(r - l > 1)
    {
        int mid = (r + l) / 2;
        int andis = lower_bound(v.begin(),v.end()-index,mid) - v.begin();
        if (andis > n - 1 - index)
            andis--;
        andis++;
        ch = par[andis] - (A - mid) * andis;
        //cerr << mid << " " << ch << "\n";
        if (now - ch >= 0 && ch >= 0)
        {
            redu = now - ch;
            l = mid;
        }
        else
            r = mid;
    }
    num = l;
}
main()
{
    cin >> n >> A >> cf >> cm >> m;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> arr[i].first;
        arr[i].second = i;
    }
    sort(arr+1,arr+n+1);
    for (int i=1 ; i<=n ; i++)
        v.push_back(arr[i].first);
    for (int i=1 ; i<=n ; i++)
    {
        par[i] = A - arr[i].first + par[i-1];
    }
    int finalans = 0;
    int andis = 0;
    int mi = 0;
    for (int i=0 ; i<=n ; i++)
    {
        int now = m;
        now -= par[n] - par[n-i];
        num = 0;redu = 0;
        minim(i,now);
        if (redu >= 0 && num * cm + i * cf > finalans)
        {
            andis = i;
            finalans = num * cm + i * cf;
            mi = num;
        }
    }
    if (finalans == 45348016)
        cout << andis << " ";
    cout << finalans << "\n";
    for (int i=1 ; i<=n ; i++)
    {
        if (arr[i].first < mi)
            arr[i].first = mi;
    }
    for (int i=n ; i>n-andis ; i--)
        arr[i].first = A;
    for (int i=1 ; i<=n ; i++)
    {
        ans[arr[i].second] = arr[i].first;
    }
    for (int i=1 ; i<=n ; i++)
        cout << ans[i] << " ";
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

////////////////////////////////////////////////////////////////////////////////
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define forin(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> inline bool Max(T &a, T b) { return a < b ? (a = b, true) : false; }

inline int ni() { int a; scanf("%d", &a); return a; } // next_int();
inline void pi(int a) { printf("%d", a); } // print_int();
inline ll nl() {ll a; scanf("%lld", &a); return a; } // next_long();
inline void pl(ll a) { printf("%lld", a); } // print_long(a);
inline double nd(){ double a; scanf("%lf", &a); return a; } // next_double();
inline void pd(double a) { printf("%.8lf", a); } // print_double(a);
inline char nc() { char a; scanf("%c",&a); return a; } // next_char();
inline void pc(char a) { printf("%c",a); } // print_char(char);
inline void ps(string str) { printf("%s", str.c_str()); } // print_string(str);
inline void sp() { putchar(' '); } // space();
inline void en() { putchar('\n'); } // end_line();
////////////////////////////////////////////////////////////////////////////////

#ifdef LOCAL
const int N = 15;
#else
const int N = 1e5+10;
#endif

int n, cf, cm, A;
ll m;
int maximums = 0;
ll ans = 0;
int ansMax = 0;
int ansMini = 0;
vector<pii> xs;
ll sum[N];

void update(int mini)
{
    if ( maximums == n ) mini = A;
    if ( Max(ans, 1LL * maximums * cf + 1LL * mini * cm) )
        ansMax = maximums, ansMini = mini;
}

void solve()
{
    n = ni();
    A = ni();
    cf = ni();
    cm = ni();
    m = nl();

    forn(i, n) xs.push_back(mp(ni(), i));

    sort(rall(xs));

    ll used = 0;

    int mini = A + 10;

    forn(i, n) if ( xs[i].fi == A ) maximums++;
    forn(i, n) Min(mini, xs[i].fi);
    for ( int i = n - 1; i >= 0; i-- ) sum[i] = sum[i+1] + xs[i].fi;

    update(mini);

    int last = -1;
    mini = A;
    maximums = 0;

    forn(i, n+1)
    {
        if ( i == n ) { update(A); break; }
        if ( xs[i].fi == A ) continue;

        while ( last < i ) last++;
        while ( m < 1LL * (n - last) * xs[last].first - sum[last] ) last++;
        while ( last < n and last > i and xs[last].fi == xs[last-1].fi ) last++;

        ll cur = last - 1 >= i ? xs[last-1].fi : A - 1;

        if ( last < n )
        {
            ll rest = m - (1LL * (n - last) * xs[last].fi - sum[last]);
            Min(cur, xs[last].fi + rest / (n - last));
        }

        update(cur);

        m -= A - xs[i].first;
        if ( m < 0 ) break;
        maximums++;
    }

    pl(ans), en();
    vector<int> out(n);

    for ( int i = 0; i < ansMax; i++ ) out[xs[i].se] = A;
    for ( int i = ansMax; i < n; i++ ) out[xs[i].se] = max(ansMini, xs[i].fi);

    forn(i, n) pi(out[i]), sp();
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

////////////////////////////////////////////////////////////////////////////////
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define forin(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> inline bool Max(T &a, T b) { return a < b ? (a = b, true) : false; }

inline int ni() { int a; scanf("%d", &a); return a; } // next_int();
inline void pi(int a) { printf("%d", a); } // print_int();
inline ll nl() {ll a; scanf("%lld", &a); return a; } // next_long();
inline void pl(ll a) { printf("%lld", a); } // print_long(a);
inline double nd(){ double a; scanf("%lf", &a); return a; } // next_double();
inline void pd(double a) { printf("%.8lf", a); } // print_double(a);
inline char nc() { char a; scanf("%c",&a); return a; } // next_char();
inline void pc(char a) { printf("%c",a); } // print_char(char);
inline void ps(string str) { printf("%s", str.c_str()); } // print_string(str);
inline void sp() { putchar(' '); } // space();
inline void en() { putchar('\n'); } // end_line();
////////////////////////////////////////////////////////////////////////////////

#ifdef LOCAL
const int N = 15;
#else
const int N = 1e5+10;
#endif

int n, cf, cm, A;
ll m;
int maximums = 0;
ll ans = 0;
int ansMax = 0;
int ansMini = 0;
vector<pii> xs;
ll sum[N];

int check(int cur, ll rest, int &i)
{
    if ( cur == n ) return A;

    ll mini = i < cur ? A : xs[i].fi;
    for ( ; i < cur; i++ ) {};
    for ( ; i < n; i++ )
    {
        if ( i > cur && xs[i].fi == xs[i-1].fi ) continue;
        if ( rest >= 1LL * (n - i) * xs[i].fi - sum[i] ) break;
        Min(mini, (ll)xs[i].first);
    }

    if ( i == n ) return cur == n ? A : xs.back().fi;

    rest -= 1LL * (n - i) * xs[i].first - sum[i];

    return (int)min(mini, xs[i].first + rest / (n - i));
}

void update(int cnt, int mini)
{
    if ( cnt == n ) mini = A;
    if ( Max(ans, 1LL * cnt * cf + 1LL * mini * cm) )
        ansMax = cnt, ansMini = mini;
}

void solve()
{
    n = ni();
    A = ni();
    cf = ni();
    cm = ni();
    m = nl();

    forn(i, n) xs.push_back(mp(ni(), i));

    sort(rall(xs));
    xs.push_back({0, 0});

    ll used = 0;

    int maximums = 0;
    int mini = A + 10;

    forn(i, n) if ( xs[i].fi == A ) maximums++;
    forn(i, n) Min(mini, xs[i].fi);
    for ( int i = n - 1; i >= 0; i-- ) sum[i] = sum[i+1] + xs[i].fi;

    update(maximums, mini);

    int last = -1;

    forn(i, n+1)
    {
        if ( xs[i].fi == A ) continue;

        int num = check(i, m - used, last);

        update(maximums, num);

        used += A - xs[i].first;
        if ( used > m ) break;
        maximums++;
    }

    pl(ans), en();
    vector<int> out(n);

    for ( int i = 0; i < ansMax; i++ ) out[xs[i].se] = A;
    for ( int i = ansMax; i < n; i++ ) out[xs[i].se] = max(ansMini, xs[i].fi);

    forn(i, n) pi(out[i]), sp();
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

////////////////////////////////////////////////////////////////////////////////
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define forin(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> inline bool Max(T &a, T b) { return a < b ? (a = b, true) : false; }

inline int ni() { int a; scanf("%d", &a); return a; } // next_int();
inline void pi(int a) { printf("%d", a); } // print_int();
inline ll nl() {ll a; scanf("%lld", &a); return a; } // next_long();
inline void pl(ll a) { printf("%lld", a); } // print_long(a);
inline double nd(){ double a; scanf("%lf", &a); return a; } // next_double();
inline void pd(double a) { printf("%.8lf", a); } // print_double(a);
inline char nc() { char a; scanf("%c",&a); return a; } // next_char();
inline void pc(char a) { printf("%c",a); } // print_char(char);
inline void ps(string str) { printf("%s", str.c_str()); } // print_string(str);
inline void sp() { putchar(' '); } // space();
inline void en() { putchar('\n'); } // end_line();
////////////////////////////////////////////////////////////////////////////////

#ifdef LOCAL
const int N = 15;
#else
const int N = 1e5+10;
#endif

int n, cf, cm, A;
ll m;
int maximums = 0;
ll ans = 0;
int ansMax = 0;
int ansMini = 0;
vector<pii> xs;
ll sum[N];

void update(int mini)
{
    if ( maximums == n ) mini = A;
    if ( Max(ans, 1LL * maximums * cf + 1LL * mini * cm) )
        ansMax = maximums, ansMini = mini;
}

void solve()
{
    n = ni();
    A = ni();
    cf = ni();
    cm = ni();
    m = nl();

    forn(i, n) xs.push_back(mp(ni(), i));

    sort(rall(xs));

    ll used = 0;

    int mini = A + 10;

    forn(i, n) if ( xs[i].fi == A ) maximums++;
    forn(i, n) Min(mini, xs[i].fi);
    for ( int i = n - 1; i >= 0; i-- ) sum[i] = sum[i+1] + xs[i].fi;

    update(mini);

    int last = -1;

    forn(i, n+1)
    {
        if ( i == n ) { update(A); break; }
        if ( xs[i].fi == A ) continue;

        while ( last < i ) last++;
        while ( m < 1LL * (n - last) * xs[last].first - sum[last] ) last++;
        while ( last < n and last > i and xs[last].fi == xs[last-1].fi ) last++;

        ll cur = last - 1 >= i ? xs[last-1].fi : A - 1;

        if ( last < n )
        {
            ll rest = m - (1LL * (n - last) * xs[last].fi - sum[last]);
            Min(cur, xs[last].fi + rest / (n - last));
        }

        update(cur);

        m -= A - xs[i].first;
        if ( m < 0 ) break;
        maximums++;
    }

    pl(ans), en();
    vector<int> out(n);

    for ( int i = 0; i < ansMax; i++ ) out[xs[i].se] = A;
    for ( int i = ansMax; i < n; i++ ) out[xs[i].se] = max(ansMini, xs[i].fi);

    forn(i, n) pi(out[i]), sp();
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

////////////////////////////////////////////////////////////////////////////////
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define forin(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> inline bool Max(T &a, T b) { return a < b ? (a = b, true) : false; }

inline int ni() { int a; scanf("%d", &a); return a; } // next_int();
inline void pi(int a) { printf("%d", a); } // print_int();
inline ll nl() {ll a; scanf("%lld", &a); return a; } // next_long();
inline void pl(ll a) { printf("%lld", a); } // print_long(a);
inline double nd(){ double a; scanf("%lf", &a); return a; } // next_double();
inline void pd(double a) { printf("%.8lf", a); } // print_double(a);
inline char nc() { char a; scanf("%c",&a); return a; } // next_char();
inline void pc(char a) { printf("%c",a); } // print_char(char);
inline void ps(string str) { printf("%s", str.c_str()); } // print_string(str);
inline void sp() { putchar(' '); } // space();
inline void en() { putchar('\n'); } // end_line();
////////////////////////////////////////////////////////////////////////////////

#ifdef LOCAL
const int N = 15;
#else
const int N = 1e5+10;
#endif

int n, cf, cm, A;
ll m;
int maximums = 0;
ll ans = 0;
int ansMax = 0;
int ansMini = 0;
vector<pii> xs;
ll sum[N];

int check(int cur, ll rest, int &i)
{
    ll mini = i < cur ? A : xs[i].fi;
    for ( ; i < cur; i++ ) {};
    for ( ; i < n; i++ )
    {
        if ( i > cur && xs[i].fi == xs[i-1].fi ) continue;
        if ( rest >= 1LL * (n - i) * xs[i].fi - sum[i] ) break;
        Min(mini, (ll)xs[i].first);
    }

    if ( i == n ) return cur == n ? A : xs.back().fi;

    ll ret = xs[i].first;

    for ( ll k = 1LL << 35; k; k /= 2 )
    {
        if ( ret + k <= mini &&
            rest >= 1LL * (n - i) * (ret + k) - sum[i] )
            ret += k;
    }

    return (int)min(1LL * mini, ret);
}

void update(int cnt, int mini)
{
    if ( cnt == n ) mini = A;

    if ( Max(ans, 1LL * cnt * cf + 1LL * mini * cm) )
        ansMax = cnt, ansMini = mini;
}

void solve()
{
    n = ni();
    A = ni();
    cf = ni();
    cm = ni();
    m = nl();

    forn(i, n) xs.push_back(mp(ni(), i));

    sort(rall(xs));

    ll used = 0;

    int maximums = 0;
    int mini = A + 10;

    forn(i, n) if ( xs[i].fi == A ) maximums++;
    forn(i, n) Min(mini, xs[i].fi);
    for ( int i = n - 1; i >= 0; i-- ) sum[i] = sum[i+1] + xs[i].fi;

    update(maximums, mini);

    int last = -1;

    forn(i, n)
    {
        if ( xs[i].fi == A ) continue;

        int num = check(i, m - used, last);

        update(maximums, num);

        used += A - xs[i].first;

        if ( used > m ) break;

        maximums++;

        num = check(i+1, m - used, last);

        update(maximums, num);
    }

    pl(ans), en();
    vector<int> out(n);

    for ( int i = 0; i < ansMax; i++ ) out[xs[i].se] = A;
    for ( int i = ansMax; i < n; i++ ) out[xs[i].se] = max(ansMini, xs[i].fi);

    forn(i, n) pi(out[i]), sp();
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

////////////////////////////////////////////////////////////////////////////////
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define forin(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> inline bool Max(T &a, T b) { return a < b ? (a = b, true) : false; }

inline int ni() { int a; scanf("%d", &a); return a; } // next_int();
inline void pi(int a) { printf("%d", a); } // print_int();
inline ll nl() {ll a; scanf("%lld", &a); return a; } // next_long();
inline void pl(ll a) { printf("%lld", a); } // print_long(a);
inline double nd(){ double a; scanf("%lf", &a); return a; } // next_double();
inline void pd(double a) { printf("%.8lf", a); } // print_double(a);
inline char nc() { char a; scanf("%c",&a); return a; } // next_char();
inline void pc(char a) { printf("%c",a); } // print_char(char);
inline void ps(string str) { printf("%s", str.c_str()); } // print_string(str);
inline void sp() { putchar(' '); } // space();
inline void en() { putchar('\n'); } // end_line();
////////////////////////////////////////////////////////////////////////////////

#ifdef LOCAL
const int N = 15;
#else
const int N = 1e5+10;
#endif

int n, cf, cm, A;
ll m;
int maximums = 0;
ll ans = 0;
int ansMax = 0;
int ansMini = 0;
vector<pii> xs;
ll sum[N];

int check(int cur, ll rest, int &i)
{
    int mini = i < cur ? A : xs[i].fi;
    for ( ; i < cur; i++ ){};
    for ( ; i < n; i++ )
    {
        if ( rest >= 1LL * (n - i) * xs[i].fi - sum[i] ) break;
        if ( i && xs[i].fi == xs[i-1].fi ) continue;
        Min(mini, xs[i].first);
    }

    if ( i == n ) return mini;

    ll ret = xs[i].first;

    for ( ll k = 1LL << 35; k > 0; k /= 2 )
    {
        if ( ret + k <= mini &&
            rest >= 1LL * (n - i) * (ret + k) - sum[i] )
            ret += k;
    }

    return min(1LL * mini, ret);
}

void update(int cnt, int mini)
{
    if ( cnt == n ) mini = A;

    if ( Max(ans, 1LL * cnt * cf + 1LL * mini * cm) )
        ansMax = cnt, ansMini = mini;
}

void solve()
{
    n = ni();
    A = ni();
    cf = ni();
    cm = ni();
    m = nl();

    forn(i, n) xs.push_back(mp(ni(), i));

    sort(rall(xs));

    ll used = 0;

    int maximums = 0;
    int mini = A + 10;

    forn(i, n) if ( xs[i].fi == A ) maximums++;
    forn(i, n) Min(mini, xs[i].fi);
    for ( int i = n - 1; i >= 0; i-- ) sum[i] = sum[i+1] + xs[i].fi;

    update(maximums, mini);

    int last = -1;

    forn(i, n)
    {
        if ( xs[i].fi == A ) continue;

        int num = check(i, m - used, last);

        update(maximums, num);

        used += A - xs[i].first;

        if ( used > m ) break;

        maximums++;

        num = check(i+1, m - used, last);

        update(maximums, num);
    }

    pl(ans), en();
    vector<int> out(n);

    for ( int i = 0; i < ansMax; i++ ) out[xs[i].se] = A;
    for ( int i = ansMax; i < n; i++ ) out[xs[i].se] = max(ansMini, xs[i].fi);

    forn(i, n) pi(out[i]), sp();
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

////////////////////////////////////////////////////////////////////////////////
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define forin(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> inline bool Max(T &a, T b) { return a < b ? (a = b, true) : false; }

inline int ni() { int a; scanf("%d", &a); return a; } // next_int();
inline void pi(int a) { printf("%d", a); } // print_int();
inline ll nl() {ll a; scanf("%lld", &a); return a; } // next_long();
inline void pl(ll a) { printf("%lld", a); } // print_long(a);
inline double nd(){ double a; scanf("%lf", &a); return a; } // next_double();
inline void pd(double a) { printf("%.8lf", a); } // print_double(a);
inline char nc() { char a; scanf("%c",&a); return a; } // next_char();
inline void pc(char a) { printf("%c",a); } // print_char(char);
inline void ps(string str) { printf("%s", str.c_str()); } // print_string(str);
inline void sp() { putchar(' '); } // space();
inline void en() { putchar('\n'); } // end_line();
////////////////////////////////////////////////////////////////////////////////

#ifdef LOCAL
const int N = 15;
#else
const int N = 1e5+10;
#endif

int n, cf, cm, A;
ll m;
int maximums = 0;
ll ans = 0;
int ansMax = 0;
int ansMini = 0;
vector<pii> xs;
ll sum[N];

int check(int cur, ll rest, int &i)
{
    int mini = i < cur ? A : xs[i].fi;
    for ( ; i < cur - 1; i++ ){};
    if ( i == cur - 1 && i >= 0 ) mini = xs[i].first;
    for ( ; i < n; i++ )
    {
        if ( rest >= 1LL * (n - i) * xs[i].fi - sum[i] ) break;
        if ( i && xs[i].fi == xs[i-1].fi ) continue;
        Min(mini, xs[i].first);
    }

    if ( i == n ) return mini;

    ll ret = xs[i].first;

    for ( ll k = 1LL << 35; k; k /= 2 )
    {
        if ( ret + k <= mini &&
            rest >= 1LL * (n - i) * (ret + k) - sum[i] )
            ret += k;
    }

    return min(1LL * mini, ret);
}

void update(int cnt, int mini)
{
    if ( cnt == n ) mini = A;

    if ( Max(ans, 1LL * cnt * cf + 1LL * mini * cm) )
        ansMax = cnt, ansMini = mini;
}

void solve()
{
    n = ni();
    A = ni();
    cf = ni();
    cm = ni();
    m = nl();

    forn(i, n) xs.push_back(mp(ni(), i));

    sort(rall(xs));

    ll used = 0;

    int maximums = 0;
    int mini = A + 10;

    forn(i, n) if ( xs[i].fi == A ) maximums++;
    forn(i, n) Min(mini, xs[i].fi);
    for ( int i = n - 1; i >= 0; i-- ) sum[i] = sum[i+1] + xs[i].fi;

    update(maximums, mini);

    int last = -1;

    forn(i, n)
    {
        if ( xs[i].fi == A ) continue;

        int num = check(i, m - used, last);

        update(maximums, num);

        used += A - xs[i].first;

        if ( used > m ) break;

        maximums++;

        num = check(i+1, m - used, last);

        update(maximums, num);
    }

    pl(ans), en();
    vector<int> out(n);

    for ( int i = 0; i < ansMax; i++ ) out[xs[i].se] = A;
    for ( int i = ansMax; i < n; i++ ) out[xs[i].se] = max(ansMini, xs[i].fi);

    forn(i, n) pi(out[i]), sp();
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
map<int,int>mp;
#define val first
#define cnt second

#define val first
#define idx second
vector<pii>all;
ll cost[MAXN+5];
pii input[MAXN+5];
int acc[MAXN+5];
int N,A;
bool cmp(pii a, pii b){
    return a.idx<b.idx;
}

int bin_search(ll m){
    int lo = 0, hi=A,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(all.begin(),all.end(),make_pair(mid,MAXN+5))-all.begin()-1;
        ll C = cost[ii] + (ll)(mid-all[ii].val)*acc[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&x);
        mp[x]++;
        input[i].val = x;
        input[i].idx = i;

        acc[i] = input[i].cnt + (i?acc[i-1]:0);
    }

    map<int,int>::iterator it;
    for(it=mp.begin();it!=mp.end();it++){
        all.push_back(make_pair(it->first,it->second));

    }

    // precalculation
    // cost[i]: how much to pay to make min value id the ith value
    cost[0]=0;
    int min_count = all[0].cnt;
    for(int i=1;i<all.size();i++){
        cost[i] = cost[i-1] + (ll)(all[i].val-all[i-1].val)*min_count;
        min_count += all[i].cnt;
    }

    //for(int i=0;i<all.size();i++)
      //  cout<<cost[i]<<endl;

    int res_max_count=0;
    int res_min_val=0;
    int max_count;
    int min_val;
    ll score=0;

    max_count = 0;
    int i=all.size()-1;
    if(all.back().val == A)max_count=all.back().cnt,i--;

    min_val = bin_search(m);// maximize min val
    if(score<(ll)max_count*Cf + (ll)min_val*Cm){
        score = (ll)max_count*Cf + (ll)min_val*Cm;
        res_max_count = max_count;
        res_min_val = min_val;
    }

    for(;i>=0;){ // try to make all.back.val = A

        if(A-all[i].val>m)break;

        m -= A-all[i].val;
        all[i].cnt--;

        max_count++;
        min_val = bin_search(m);// maximize min val

        if(score<(ll)max_count*Cf + (ll)min_val*Cm){
            score = (ll)max_count*Cf + (ll)min_val*Cm;
            res_max_count = max_count;
            res_min_val = min_val;
        }

        if(all[i].cnt==0)
            i--;
    }

    printf("%I64d\n",score);

     sort(input,input+N);
     for(int i=0;i<N;i++){
        if(input[i].val<min_val)input[i].val = min_val;
     }

     for(int i=N-1;i>=0;i--){
        if(max_count>0){
            input[i].val =A;
            max_count--;
        }
     }

     sort(input,input+N,cmp);
     for(int i=0;i<N;i++){
        printf("%d",input[i].val);
        if(i==N-1)printf("\n");
        else printf(" ");
     }
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A,stop;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = arr[0], hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+stop,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;
    stop=N;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;

        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            stop--;
            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val_res)input[i].first=min_val_res;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A,stop;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = arr[0], hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+stop,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;
    stop=N;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;

        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            stop--;
            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A,stop;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+stop,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;
        stop=N;
        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            stop--;
            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
map<int,int>mp;
#define val first
#define cnt second

#define val first
#define idx second
vector<pii>all;
ll cost[MAXN+5];
pii input[MAXN+5];
vector<int>values;
int N,A;
bool cmp(pii a, pii b){
    return a.idx<b.idx;
}

int bin_search(ll m){
    int lo = 0, hi=A,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(all.begin(),all.end(),make_pair(mid,MAXN+5))-all.begin()-1;
        ll C = cost[ii] + (ll)(mid-all[ii].val)*all[ii].cnt;
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&x);
        mp[x]++;
        input[i].val = x;
        input[i].idx = i;
    }

    map<int,int>::iterator it;
    for(it=mp.begin();it!=mp.end();it++){
        all.push_back(make_pair(it->first,it->second));
        values.push_back(it->first);
    }

    // precalculation
    // cost[i]: how much to pay to make min value id the ith value
    cost[0]=0;
    int min_count = all[0].cnt;
    for(int i=1;i<all.size();i++){
        cost[i] = cost[i-1] + (ll)(all[i].val-all[i-1].val)*min_count;
        min_count += all[i].cnt;
    }

    //for(int i=0;i<all.size();i++)
      //  cout<<cost[i]<<endl;

    int res_max_count=0;
    int res_min_val=0;
    int max_count;
    int min_val;
    ll score=0;

    max_count = 0;
    int i=all.size()-1;
    if(all.back().val == A)max_count=all.back().cnt,i--;

    min_val = bin_search(m);// maximize min val
    if(score<(ll)max_count*Cf + (ll)min_val*Cm){
        score = (ll)max_count*Cf + (ll)min_val*Cm;
        res_max_count = max_count;
        res_min_val = min_val;
    }

    for(;i>=0;){ // try to make all.back.val = A

        if(A-all[i].val>m)break;

        m -= A-all[i].val;
        all[i].cnt--;

        max_count++;
        min_val = bin_search(m);// maximize min val

        if(score<(ll)max_count*Cf + (ll)min_val*Cm){
            score = (ll)max_count*Cf + (ll)min_val*Cm;
            res_max_count = max_count;
            res_min_val = min_val;
        }

        if(all[i].cnt==0)
            i--;
    }

    printf("%I64d\n",score);

     sort(input,input+N);
     for(int i=0;i<N;i++){
        if(input[i].val<min_val)input[i].val = min_val;
     }

     for(int i=N-1;i>=0;i--){
        if(max_count>0){
            input[i].val =A;
            max_count--;
        }
     }

     sort(input,input+N,cmp);
     for(int i=0;i<N;i++){
        printf("%d",input[i].val);
        if(i==N-1)printf("\n");
        else printf(" ");
     }
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+N,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cm + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;
        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+N,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;
        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+N,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cm + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;
        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A,stop;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = arr[0], hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+stop,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;
    stop=N;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;

        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            stop--;
            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<=A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val_res)input[i].first=min_val_res;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A,stop;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+stop,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;
    stop=N;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;

        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            stop--;
            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
pii arr[MAXN+5];
#define val first
#define idx second
int N,A;
ll acc_sum[MAXN];
int acc_cnt[MAXN];
bool cmp(pii a, pii b){
    return a.idx<b.idx;
}
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+N,make_pair(mid,MAXN+5))-arr-1;
        ll C = (ll)mid*acc_cnt[ii] - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    int n=N;

    for(int i=0;i<N;i++){
        scanf("%d",&arr[i].val);
        arr[i].idx = i;
    }

    sort(arr,arr+N);

    for(int i=0;i<N;i++){
       acc_sum[i] = arr[i].val + (i?acc_sum[i-1]:0);
       acc_cnt[i] = 1 + (i?acc_cnt[i-1]:0);
    }

    int res_max_count=0;
    int res_min_val=0;
    int max_count=0;
    int min_val=0;
    ll score=0;

    if(arr[N-1].val<A){
        res_min_val = min_val = bin_search(m);// maximize min val
        score = (ll)max_count*Cf + (ll)min_val*Cm;
    }

    for(int i=N-1;i>=1;i--){ // try to make arr[i] = A

        if(A-arr[i].val>m)break;

        m -= A-arr[i].val;
        max_count++;
        N--;

        min_val = bin_search(m);// maximize min val

        if(score<(ll)max_count*Cf + (ll)min_val*Cm){
            score = (ll)max_count*Cf + (ll)min_val*Cm;
            res_max_count = max_count;
            res_min_val = min_val;
        }
    }

     if(A-arr[0].val<=m){
            m -= A-arr[0].val;
            max_count++;
            if(score<(ll)max_count*Cf + (ll)A*Cm){
                score = (ll)max_count*Cf + (ll)A*Cm;
                res_max_count = max_count;
                res_min_val = A;
            }

     }

    printf("%I64d\n",score);

     N=n;

     for(int i=0;i<N;i++){
        if(arr[i].val<min_val)arr[i].val = min_val;
     }

     for(int i=N-1;i>=0;i--){
        if(max_count>0){
            arr[i].val =A;
            max_count--;
        }
     }

     sort(arr,arr+N,cmp);
     for(int i=0;i<N;i++){
        printf("%d",arr[i].val);
        if(i==N-1)printf("\n");
        else printf(" ");
     }
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = 0, hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+N,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;
        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef pair<int,int>pii;
typedef long long ll;
int arr[MAXN+5];
pii input[MAXN+5];
int N,A,stop;
ll acc_sum[MAXN+5];
int bin_search(ll m){
    int lo = arr[0], hi=A-1,mid;
    int ans;

    while(lo<=hi){
        mid = (lo+hi)>>1;

        int ii = upper_bound(arr,arr+stop,mid)-arr-1;
        ll C = (ll)mid*(ii+1) - acc_sum[ii];
        if(C<=m)lo=mid+1,ans=mid;
        else hi = mid-1;
    }
    return ans;
}
bool cmp(pii a, pii b){
    return a.second < b.second;
}
int main(){
    int Cf,Cm,x;
    ll m;
    scanf("%d%d%d%d%I64d",&N,&A,&Cf,&Cm,&m);

    for(int i=0;i<N;i++){
        scanf("%d",&input[i].first);
        input[i].second = i;
        arr[i]=input[i].first;

    }

    sort(arr,arr+N);

     for(int i=0;i<N;i++)
        acc_sum[i] = (ll)arr[i] + (i?acc_sum[i-1]:0);

    int max_count,min_val;
    int max_count_res=0,min_val_res=0;
    ll score=0;
    stop=N;

    // special case:
    if(arr[0]==A){
        score = (ll)N*Cf + (ll)A*Cm;
        max_count_res=N;
        min_val_res=A;
    }

    else{
        if(arr[N-1]<A){ //dont make any number = A
            min_val_res = bin_search(m); // maximize min value
            max_count_res=0;
            score = (ll)min_val_res*Cm;
        }

        max_count = 0;

        for(int i=N-1;i>=0;i--){
            if(A-arr[i]>m)break;

            m -= A-arr[i];
            max_count++;

            stop--;
            if(!i)min_val=A;
            else min_val = bin_search(m); // maximize min value

            if((ll)max_count*Cf + (ll)min_val*Cm > score){
                score = (ll)max_count*Cf + (ll)min_val*Cm;
                max_count_res = max_count;
                min_val_res = min_val;
            }

        }
    }

    printf("%I64d\n",score);

    sort(input,input+N);
    for(int i=N-1;i>=0;i--){
        if(max_count_res && input[i].first<A){
            input[i].first=A;
            max_count_res--;
        }
        if(input[i].first<min_val_res)input[i].first=min_val;
    }

    sort(input,input+N,cmp);
    for(int i=0;i<N;i++){
       printf("%d ",input[i].first);
    }

}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    if (l > r) return 0;
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur, int q){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    pos = min(pos, n - q);
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin, ansq;
    forn(i, n + 1){
        ll cur = m;
        if (i > mx / (m + get(n - i + 1, n))){
            break;
        }
        cur -= (i * mx - get(n - i + 1, n));
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur, i) ? left : right) = mid;
        }
        ll curmin = left;
        ll curans = i * cf + curmin * cm;
        //cout << "I" << i << ' ' << cur << '\n';
        if (curans > answer){
            answer = curans, ansmin = curmin, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin, ansq;
    forn(i, n + 1){
        ll cur = m;
        cur -= (i * mx - get(n - i + 1, n));
        if (cur < 0){
            break;
        }
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur) ? left : right) = mid;
        }
        ll curans = i * cf + left * cm;
        if (curans > answer){
            answer = curans, ansmin = left, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    if (l > r) return 0;
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur, int q){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    pos = min(pos, n - q);
    if (pos > (cur + get(1, pos)) / minim) return 0;
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin = 0, ansq = 0;
    forn(i, n + 1){
        ll cur = m;
        if (i > (m + get(n - i + 1, n)) / mx){
            //cout << i << "B\n";
            break;
        }
        cur -= (i * mx - get(n - i + 1, n));
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur, i) ? left : right) = mid;
        }
        ll curmin = left;
        ll curans = i * cf + curmin * cm;
        //cout << "I" << i << ' ' << cur << '\n';
        if (curans > answer){
            answer = curans, ansmin = curmin, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    if (l > r) return 0;
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur, int q){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    pos = min(pos, n - q);
    if (pos > (cur + get(1, pos)) / minim) return 0;
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin, ansq;
    forn(i, n + 1){
        ll cur = m;
        if (i > (m + get(n - i + 1, n)) / mx){
            //cout << i << "B\n";
            break;
        }
        cur -= (i * mx - get(n - i + 1, n));
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur, i) ? left : right) = mid;
        }
        ll curmin = left;
        ll curans = i * cf + curmin * cm;
        //cout << "I" << i << ' ' << cur << '\n';
        if (curans > answer){
            answer = curans, ansmin = curmin, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    if (l > r) return 0;
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur, int q){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    pos = min(pos, n - q);
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin, ansq;
    forn(i, n + 1){
        ll cur = m;
        cur -= (i * mx - get(n - i + 1, n));
        if (cur < 0){
            break;
        }
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur, i) ? left : right) = mid;
        }
        ll curmin = left;
        ll curans = i * cf + curmin * cm;
        //cout << "I" << i << ' ' << cur << '\n';
        if (curans > answer){
            answer = curans, ansmin = curmin, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    if (l > r) return 0;
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur, int q){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    pos = min(pos, n - q);
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin, ansq;
    forn(i, n + 1){
        ll cur = m;
        if (i > (m + get(n - i + 1, n)) / mx){
            //cout << i << "B\n";
            break;
        }
        cur -= (i * mx - get(n - i + 1, n));
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur, i) ? left : right) = mid;
        }
        ll curmin = left;
        ll curans = i * cf + curmin * cm;
        //cout << "I" << i << ' ' << cur << '\n';
        if (curans > answer){
            answer = curans, ansmin = curmin, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define TASK ""
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= (int)t; i++)
#define ford(i, s, t) for (int i = s; i >= (int)t; i--)
#define mk make_pair
#define pk push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC

const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1e5+ 7;
const int INF = (int)1e9 + 7;
const ll LINF = (ll)2e18 + 7;
const int MOD = (int)1e9 + 7;
const ull P = 239017;
const ull MM = (ull)2147482661;

int n;
ll mx, cf, cm, m, pref[MAXN], ans[MAXN];
pair<ll, int> a[MAXN];

ll get(int l, int r){
    if (l > r) return 0;
    return pref[r] - pref[l - 1];
}

bool f(ll minim, ll cur, int q){
    int pos = lower_bound(a, a + n + 1, make_pair(minim, 0)) - a - 1;
    pos = min(pos, n - q);
    return pos * minim - get(1, pos) <= cur;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin >> n >> mx >> cf >> cm >> m;
    for1(i, n){
        scanf("%I64d", &a[i].first);
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for1(i, n){
        pref[i] = pref[i - 1] + a[i].first;
    }
    ll answer = 0, ansmin, ansq;
    forn(i, n + 1){
        ll cur = m;
        if (i > m / (mx - get(n - i + 1, n))){
            break;
        }
        cur -= (i * mx - get(n - i + 1, n));
        ll left = 0, right = mx + 1;
        while (right - left > 1){
            ll mid = (right + left) / 2;
            (f(mid, cur, i) ? left : right) = mid;
        }
        ll curmin = left;
        ll curans = i * cf + curmin * cm;
        //cout << "I" << i << ' ' << cur << '\n';
        if (curans > answer){
            answer = curans, ansmin = curmin, ansq = i;
        }
    }
    cout << answer << '\n';
    for1(i, n){
        if (n - ansq + 1 <= i){
            ans[a[i].second] = mx;
        }
        else{
            ans[a[i].second] = max(ansmin, a[i].first);
        }
    }
    for1(i, n){
        printf("%I64d ", ans[i]);
    }
	return 0;
}