#include <bits/stdc++.h>
using namespace std;
namespace SimpleModInt {
    constexpr int md = (int)1e9 + 7;
    inline int norm(long long a) {
        return (a % md + md) % md;
    }
    inline int add(int a, int b) {
        a += b;
        if (a >= md) a -= md;
        return a;
    }
    inline int sub(int a, int b) {
        a -= b;
        if (a < 0) a += md;
        return a;
    }
    inline int mul(int a, int b) {
        return (int)((long long)a * b % md);
    }
    inline int powmod(int a, long long b) {
        int res = 1;
        while (b > 0) {
            if (b & 1) res = mul(res, a);
            a = mul(a, a);
            b >>= 1;
        }
        return res;
    }
    inline int inv(int a) {
        a %= md;
        if (a < 0) a += md;
        int b = md, u = 0, v = 1;
        while (a) {
            int t = b / a;
            b -= t * a; swap(a, b);
            u -= t * v; swap(u, v);
        }
        assert(b == 1);
        if (u < 0) u += md;
        return u;
    }
}
using namespace SimpleModInt;
struct matrix {
    int n, m;
    vector<vector<int>> a;
    matrix() {}
    matrix(vector<vector<int>> k) {
        n = k.size();
        m = k[0].size();
        a = k;
    }
    matrix operator* (const matrix& c) const {
        int n = a.size();
        int m = c.a[0].size();
        vector<vector<int>> b(n, vector<int>(m, 0));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < a[i].size(); k++) {
                    b[i][j] = add(b[i][j], mul(a[i][k], c.a[k][j]));
                }
            }
        }
        return matrix(b);
    }
    matrix powmod(long long k) {
        k--;
        vector<vector<int>> res = a;
        vector<vector<int>> b = a;
        while (k > 0) {
            if (k & 1) res = (matrix(res) * matrix(b)).a;
            b = (matrix(b) * matrix(b)).a;
            k >>= 1;
        }
        return matrix(res);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int INV2 = inv(2);
    int n, m, k;
    cin >> n >> m >> k;
    int INVM = inv(m);
    vector<vector<int>> g(n);
    vector<vector<int>> c(n, vector<int>(n, 0));
    vector<int> a(n);
    for (auto& i : a) cin >> i;
    if (!k) {
        for (auto i : a) {
            cout << i << "\n";
        }
        return 0;
    }
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for (int i = 0; i < n; i++) {
        c[i][i] = mul((m - g[i].size()) + mul(INV2, g[i].size()), INVM);
        for (auto to : g[i]) {
            c[i][to] = mul(INVM, INV2);
        }
    }
    auto res = matrix(c).powmod(k);
    for (int i = 0; i < n; i++) {
        int val = 0;
        for (int j = 0; j < n; j++) {
            val = add(val, mul(a[j], res.a[i][j]));
        }
        cout << val << "\n";
    }
    return 0;
}
#include<bits/stdc++.h>
#define db double
#define reg register
#define LL long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define ull unsigned long long
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define erep(i,a) for(int i=head[a];i;i=e[i].nxt)


using namespace std;
bool Handsome;
inline void Mi(int &x,int y){if(x>y && (x=y));}
inline void Mx(int &x,int y){if(x<y && (x=y));}
const int M=105,P=1e9+7,INV=5e8+4;
int n,m,mv,k,A[M];
void Add(int &x,int y){
	x+=y;
	if(x>=P)x-=P;
	if(x<0)x+=P;
}
int FAST(int x,int y){
	int res=1;
	for(;y;y>>=1){
		if(y&1)res=1ll*res*x%P;
		x=1ll*x*x%P;
	}
	return res;
}
struct Mtx{
	int a[M][M];
	Mtx (){memset(a,0,sizeof(a));}
	Mtx operator * (const Mtx x)const{
		Mtx y;
		rep(i,1,n)rep(j,1,n)rep(k,1,n)
			Add(y.a[i][k],1ll*a[i][j]*x.a[j][k]%P);
		return y;
	}
	void Print(){
		rep(i,1,n){
			int x=0;
			rep(j,1,n)Add(x,1ll*a[i][j]*A[j]%P);
			printf("%d\n",x);
		}
	}
}f,res;
bool Most;
int main(){
//	printf("%.2lfMB\n",(&Most-&Handsome)/1024.0/1024.0);
	scanf("%d%d%d",&n,&m,&k);
	mv=FAST(m,P-2);
	rep(i,1,n)scanf("%d",&A[i]);
	rep(i,1,n)f.a[i][i]=res.a[i][i]=1;
	rep(i,1,m){
		int x,y;scanf("%d%d",&x,&y);
		Add(f.a[x][y],1ll*mv*INV%P);
		Add(f.a[x][x],-1ll*mv*INV%P);
		
		Add(f.a[y][x],1ll*mv*INV%P);
		Add(f.a[y][y],-1ll*mv*INV%P);
	}
	for(;k;k>>=1){
		if(k&1)res=res*f;
		f=f*f;
	}
	res.Print();
	return 0;
}