#define wiwihorz
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define INF 1000000000000000000
#define eps (1e-9)
#define MAXN 1000005
#define MOD 1000000007

using namespace std;
using namespace __gnu_pbds;

#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt199374 rnd(chrono::steady_clock::now().time_since_epoch().count())
#define treap tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); }
#else
#define print(...) 0
#define vprint(...) 0
#endif
struct mat {
	int n;
	vector<vector<int>> v;
	void init_(int _n) {
		n = _n;
		v.assign(n + 1, vector<int>(n + 1, 0));
	}
	void id() {
		rep(i, 1, n) v[i][i] = 1;
	}
	mat operator*(mat b) {
		mat ans; ans.init_(b.n);
		rep(i, 1, n) rep(j, 1, n) {
			rep(k, 1, n) {
				ans.v[i][j] = (ans.v[i][j] + 
					v[i][k] * b.v[k][j] % MOD) % MOD;
			}
		}
		return ans;
	}
};
namespace solver {
	int n, m, k;
	vector<vector<int>> mp;
	vector<int> a;
	void init_(int _n, int _m, int _k) {
		n = _n, m = _m, k = _k;
		mp.assign(n + 1, vector<int>());
		a.assign(n + 1, 0);
	}
	int pow_(int a, int times) {
		int ans = 1;
		for(; times > 0; times >>= 1, a = a * a % MOD) {
			if(times & 1) ans = ans * a % MOD;
		}
		return ans;
	}
	void solve() {
		mat s, ans; 
		s.init_(n), ans.init_(n), ans.id();
		int invM = pow_(m, MOD - 2), inv2 = pow_(2, MOD - 2);
		rep(i, 1, n) {
			s.v[i][i] = 1 - invM * mp[i].size() % MOD * inv2 % MOD;
			for(auto j : mp[i]) {
				s.v[i][j] = invM * inv2 % MOD;
			}
		}
		for(; k > 0; k >>= 1, s = s * s) {
			if(k & 1) ans = ans * s;
		}
		rep(i, 1, n) {
			int cur = 0;
			rep(j, 1, n) {
				cur += a[j] * ans.v[i][j];
				cur %= MOD;
			}
			cout << (cur % MOD + MOD) % MOD << "\n";
		}
		
	}
	
};
using namespace solver;
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int n, m, k; cin >> n >> m >> k;
	init_(n, m, k);
	rep(i, 1, n) cin >> a[i];
	rep(i, 1, m) {
		int x, y; cin >> x >> y;
		mp[x].push_back(y);
		mp[y].push_back(x);
	}
	solve();
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

// 組合せを素数で割った値
const int MAX = 510000;
const ll MOD = 1e9 + 7;
ll fac[MAX], finv[MAX], inv[MAX];

// 前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
ll COM(int n, int r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

// 繰り返し自乗法(x^nをmで割った余り) O(logn)
ll power(ll x, ll n, ll m) {
  ll res = 1;
  if (n > 0) {
    res = power(x, n / 2, m);
    if (n % 2 == 0) res = (res * res) % m;
    else res = ((res * res % m) * x) % m;
  }
  return res;
}

// A*B(行列の掛け算, 各項はmで割った余り)
vector<vector<ll>> mul(const vector<vector<ll>> &A, const vector<vector<ll>> &B, ll m) {
  vector<vector<ll>> C(A.size(), vector<ll>(B[0].size(), 0));
  for (int i = 0; i < A.size(); i++) {
    for (int k = 0; k < B.size(); k++) {
      for (int j = 0; j < B[0].size(); j++) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % m;
      }
    }
  }
  return C;
}

// A^n(行列累乗, 各項はmで割った余り)
vector<vector<ll>> power_M(vector<vector<ll>> A, ll n, ll m) {
  vector<vector<ll>> B(A.size(), vector<ll>(A.size(), 0));
  for (int i = 0; i < A.size(); i++) B[i][i] = 1;
  
  while (n > 0) {
    if (n & 1) B = mul(B, A, m);
    A = mul(A, A, m);
    n >>= 1;
  }
  return B;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  COMinit();
  
  ll n, m, kk;
  cin >> n >> m >> kk;
  
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  vector<ll> x(m), y(m);
  for (int i = 0; i < m; i++) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
  }
  
  ll inv_2 = power(2, MOD - 2, MOD);
  
  vector<vector<ll>> M(n, vector<ll>(n, 0));
  for (int k = 0; k < m; k++) {
    M[x[k]][y[k]] += inv_2;
    M[x[k]][y[k]] %= MOD;
    M[x[k]][x[k]] += inv_2;
    M[x[k]][x[k]] %= MOD;
    M[y[k]][x[k]] += inv_2;
    M[y[k]][x[k]] %= MOD;
    M[y[k]][y[k]] += inv_2;
    M[y[k]][y[k]] %= MOD;
    for (int i = 0; i < n; i++) {
      if (i == x[k] || i == y[k]) continue;
      M[i][i] += 1;
      M[i][i] %= MOD;
    }
  }
  
  vector<vector<ll>> M2 = power_M(M, kk, MOD);
  
  ll keep = power(power(m, kk, MOD), MOD - 2, MOD);
  
  vector<ll> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
//      cout << M2[i][j] << " ";
      ans[i] += M2[i][j] * a[j] % MOD;
      ans[i] %= MOD;
    }
//    cout << endl;
    cout << (ans[i] * keep) % MOD << '\n';
  }
}