#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 int long long
#define pb push_back
#define mp make_pair
#define for0(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define w(x) int x;cin>>x;while(x--)
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define vvi vector<vector<int>>
#define precision(x,k) fixed<<setprecision(k)<<x
#define inf 1e16
int eps = 1e-9;
int arr[300005];

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	//cout << "YES" << endl;
	double k, n, m;
	cin >> k >> n >> m;
	double x = m / n;
    //cout<<x<<endl;
	vector<int>ans;
	vector<pair<double, int>>temp;
	for0(i, k)
	{
		cin >> arr[i];
	}
	int sum = 0;
	for0(i, k)
	{
		double cc = x * arr[i];
		int jj = cc;
		double rem = cc - jj;
       // cout<<jj<<" "<<cc<<" "<<arr[i]<<endl;
		ans.push_back(jj);
		sum += jj;
		temp.push_back({rem, i});
	}
	sort(temp.begin(), temp.end());
	int remaning = m - sum;
    //cout<<remaning<<endl;
	int kkk = 0;
	for(int i=k-1;i>=0;i--)
	{
        if (kkk == remaning)
			break;
		pair<int, int>pp = temp[i];
      //  cout<<pp.second<<endl;
		ans[pp.second]++;
		kkk++;
		
	}
	for0(i, k)
	cout << ans[i] << " ";
	cout << endl;

	return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<tuple>
#include<cstring>
#include<bitset>

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define pb push_back
#define eb emplace_back

#define INF 1000000000
#define INFLL 1000000000000000000LL

using namespace std;

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using PP = pair<ll, ll>;

#define MAX_N 200000+100

ll N, K, now, ans;
PP X[MAX_N];

int main() {

	cin >> N >> K;

	REP(i, N)cin >> X[i].first >> X[i].second;
	X[N].first = INFLL * 2;

	sort(X, X + N + 1);

	REP(i, N+1) {
		if (X[i].first <= now + K) {
			K -= X[i].first - now;
			K += X[i].second;
			now = X[i].first;
		}
		else {
			break;
		}
	}

	cout << now + K << endl;

	return 0;
}