#include<bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
typedef priority_queue <ll> pq;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

const ll mod = 1000000007;
const ll INF = (ll)1e18;
const ll MAXN = 1000006;

ll po(ll x, ll n){ 
    ll ans=1;
    while(n>0){ if(n&1) ans=(ans*x)%mod; x=(x*x)%mod; n/=2;}
    return ans;
}


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

    int T=1;
    //cin >> T;
    while(T--){
    
        ll n;
        cin>>n;
        ll a[n];
        rep(i,n) cin>>a[i];

        ll mx = 0;
        ll tmp = 0;
        ll curr = 0;
        rep(i,n){
            mx = max(mx, a[i]);
            tmp+=a[i];
            curr+=tmp;
            cout<<mx*(i+1)+curr<<el;
        }
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using vi = vector<int>; 
using vll = vector<long long>; 
using vb = vector<bool>;
using vd = vector<double>;
using vc = vector<char>;
using vvi = vector<vector<int>>; 
using vvll = vector<vector<long long>>;
using vvc = vector<vector<char>>;
using pii = pair<int,int>; 
using pll = pair<ll,ll>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using graph = vector<vector<pair<T, int>>>;// pair of weight and vertex
template<typename T> inline bool chmax(T& a, const T b){if(a < b){ a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a, const T b){if(a > b){ a = b; return true; } return false; }
bool check(const vll& a, const ll n, const ll m, const ll val){
    
    ll left = 0, right = 0;
    for(const auto x: a){
        left += ((m*x-val)+n-1)/n;
        right += (m*x+val)/n;
    }
    return left <= m && m <= right;
}
vll rev(const vll& a, const ll n, const ll m, const ll val){

    ll sum = 0;
    for(const auto x: a){
        const ll left = ((m*x-val)+n-1)/n;
        sum += left;
    }

    vll b;
    for(const auto x: a){
        const ll left = ((m*x-val)+n-1)/n;
        const ll right = (m*x+val)/n;

        if(sum == m){
            b.push_back(left);
        }
        else if(sum + right - left <= m){
            sum += right - left;
            b.push_back(right);
        }else if(sum + right - left > m){
            sum = m;
            b.push_back(left + m - sum);
        }
    }

    return b;
}
void my_answer(){
    // binary search
   ll k, n, m;
   cin >> k >> n >> m;

   vll a(k);
   for(auto& x: a) cin >> x;

   int ng = -1, ok = 1000000009;
   while(ok - ng > 1){
       const int mid = (ok + ng) / 2;
       if(check(a, n, m, mid)) ok = mid;
       else ng = mid;
   }

   vll b = rev(a, n, m, ok);

   for(int i = 0; i < k; ++i){
       if(i < k-1) cout << b[i] << " ";
       else cout << b[i] << endl;
   }

}
void best_answer(){
   // greedy
   ll k, n, m;
   cin >> k >> n >> m;

   vll a(k);
   vll b(k);
   vector<pll> c(k);
   ll sum_l = 0;
   for(int i = 0; i < k; ++i){
       // l := a*m/n;
       // |nb - ma| = |n(l + x) - ma| = |(nl-ma) + nx|
       // x \in {0, 1}
       // c := nl - ma;
       // \sum_i l_i == M
       cin >> a[i];
       const ll l = a[i]*m/n;
       b[i] = l;
       sum_l += l;
       c[i] = pll{n*l - m*a[i], i};
   }

    ll num_x = m - sum_l;
   sort(c.begin(), c.end());
   for(ll i = 0; i < num_x; ++i){
       b[c[i].second] += 1;
   }
   for(int i = 0; i < k; ++i){
       if(i < k-1) cout << b[i] << " ";
       else cout << b[i] << endl;
   }
}
int main(){

    // my_answer();
    best_answer();
}
