#include <bits/stdc++.h>
using namespace std;
 
void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
 
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
 
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
 
#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());  // returns unsigned ints! 

int main() {
	int K, N, M;
	cin >> K >> N >> M;

	vector<int> A(K);
	for(int i = 0; i < K; i++)
		cin >> A[i];

	vector<long long> B(K);

	auto can = [&] (long long tar) {
		// |N * B_i - M * A_i| <= tar
		vector<long long> low(K), high(K);
		for(int i = 0; i < K; i++) {
			low[i] = ((long long) M * A[i] - tar);
			if(low[i] < 0) {
				low[i] = 0;
			}
			else
				low[i] = (low[i] + N - 1) / N;	

			high[i] = ((long long) M * A[i] + tar) / N;

			while(low[i] > 0 && abs((long long) N * (low[i] - 1) - (long long) M * A[i]) <= tar)
					low[i]--;
				while(abs((long long) N * (high[i] + 1) - (long long) M * A[i]) <= tar)
					high[i]++;

			if(low[i] <= high[i]) {
				while(low[i] > 0 && abs((long long) N * (low[i] - 1) - (long long) M * A[i]) <= tar)
					low[i]--;
				while(abs((long long) N * (high[i] + 1) - (long long) M * A[i]) <= tar)
					high[i]++;
				if(low[i] > high[i])
					return false;
				assert(abs((long long) N * low[i] - (long long) M * A[i]) <= tar);
				assert(abs((long long) N * high[i] - (long long) M * A[i]) <= tar);
			}
		}

		long long have = M;
		for(int i = 0; i < K; i++) {

			B[i] = low[i];
			have -= low[i];
		}

		if(have < 0)
			return false;

		for(int i = 0; i < K; i++) {
			long long can = high[i] - low[i];
			B[i] += min(can, have);
			have -= min(can, have);
		}

		if(have > 0)
			return false;

		return true;
	};

	long long lo = 0, hi = 1E18 + 5;
	while(lo < hi) {
		long long mid = (lo + hi) / 2;
		if(can(mid))
			hi = mid;
		else
			lo = mid + 1;
	}

	assert(can(lo));

	for(int i = 0; i < K; i++)
		cout << B[i] << ' ';
	cout << '\n';
}
#include<bits/stdc++.h>
template <typename _Tp>void read(_Tp &x){
	char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();
	if(f)x=-x;
}
template <typename _Tp,typename... Args>void read(_Tp &t,Args &...args){read(t);read(args...);}
const int N=105,mod=1000000007,inv2=(mod+1)/2;
typedef long long ll;
template<typename _Tp1,typename _Tp2>inline void add(_Tp1 &a,_Tp2 b){(a+=b)>=mod&&(a-=mod);}
template<typename _Tp1,typename _Tp2>inline void sub(_Tp1 &a,_Tp2 b){(a-=b)<0&&(a+=mod);}
ll ksm(ll a,ll b=mod-2){ll res=1;while(b){if(b&1)res=res*a%mod;a=a*a%mod,b>>=1;}return res;}
int a[N],b[N];
int X[N*N],Y[N*N],n;
struct mat{
	int a[N][N];
	mat operator * (const mat &o)const{
		mat c;memset(c.a,0,sizeof(c.a));
		for(int i=0;i<n;++i)for(int k=0;k<n;++k)for(int j=0;j<n;++j)add(c.a[i][j],1ULL*a[i][k]*o.a[k][j]%mod);
		return c;
	}
}I,M,orig;
mat ksm(mat a,int b){
	mat res=I;
	while(b){
		if(b&1)res=res*a;
		a=a*a,b>>=1;
	}
	return res;
}
int main(){
	int m,k;read(n,m,k);
	for(int i=0;i<n;++i)I.a[i][i]=1;
	for(int i=0;i<n;++i)read(orig.a[i][0]);
	for(int i=1;i<=m;++i)read(X[i],Y[i]);
	ll inv=ksm(m);
	for(int i=0;i<n;++i)M.a[i][i]=1;
	for(int i=1;i<=m;++i){
		int x=X[i]-1,y=Y[i]-1;
		add(M.a[x][x],1LL*inv*(mod-inv2)%mod),add(M.a[x][y],1LL*inv*inv2%mod);
		add(M.a[y][y],1LL*inv*(mod-inv2)%mod),add(M.a[y][x],1LL*inv*inv2%mod);
	}
	mat o=ksm(M,k)*orig;
	for(int i=0;i<n;++i)printf("%d\n",o.a[i][0]);
	return 0;
}