#include<bits/stdc++.h> 
#define int long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define endl "\n"

using namespace std;

const int max_n = 105;
const int max_k = 22;
const int off_set = 1e5+5;
const int max_A = 55;
const int Mod = 1e9+7;
const long long inf = 1e18;


vector<vector<int> > mul(vector<vector<int> >& a,vector<vector<int> >& b){
    vector<vector<int> > c(a.size(),vector<int>(b[0].size(),0));

    for(int i=0;i<a.size();i++){
        for(int j=0;j<b[0].size();j++){
            for(int k=0;k<a[0].size();k++){
                c[i][j]+=(a[i][k]*b[k][j])%Mod;
                c[i][j]%=Mod;
            }
        }
    }

    return c;
}

vector<vector<int> > power(vector<vector<int>>& a,int b){
    if(b==0){
        vector<vector<int> > ans(a.size(),vector<int>(a[0].size(),0));
        for(int i=0;i<a.size();i++){
            ans[i][i]=1;
        }
        return ans;
    }
    vector<vector<int> > temp = power(a,b/2);
    temp = mul(temp,temp);

    if(b%2==0){
        return temp;
    }else{
        return mul(a,temp);
    }
}

int power_int(int a,int b){
    if(b==0) return 1;
    int temp = power_int(a,b/2)%Mod;
    if(b%2==0){
        return (temp*temp)%Mod;
    }else{
        return (a*((temp*temp)%Mod))%Mod;
    }
}

int n,m,k;
int a[max_n];
vector<int> adj[max_n];

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m>>k;
    for(int i=0;i<n;i++) cin>>a[i];

    for(int i=0;i<m;i++){
        int x,y;cin>>x>>y;x--;y--;
        adj[x].pb(y);
        adj[y].pb(x);
    }

    vector<vector<int> > T(n,vector<int>(n,0));

    int inverse_2 = power_int(2,Mod-2);
    int inverse_m = power_int(m,Mod-2);

    for(int i=0;i<n;i++){
        int deg = adj[i].size();

        T[i][i]=((m-deg)*power_int(m,Mod-2))%Mod;
        int other = (deg*power_int(2*m,Mod-2))%Mod;

        T[i][i] = (T[i][i]+other)%Mod;

        for(int y:adj[i]){
            T[i][y]=(inverse_2*inverse_m)%Mod;
        }
    }

    T = power(T,k);

    vector<vector<int>> V(n,vector<int>(1,0));
    for(int i=0;i<n;i++){
        V[i][0]=a[i];
    }

    T = mul(T,V);

    for(int i=0;i<n;i++){
        cout<<T[i][0]<<endl;
    }

}
#include <bits/stdc++.h>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#include <bitset>
#include <list>

using namespace std;

#define rep(i,n,m) for(ll (i)=(n);(i)<(m);(i)++)
#define rrep(i,n,m) for(ll (i)=(n);(i)>(m);(i)--)
using ll = long long;
const ll mod = 1000000007;
const ll inf = 100000000;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % mod;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % mod;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

ll inverse(ll n){
    return pow(n,mod-2);
}

void pline(vector<ll> lis){
    rep(i,0,lis.size()){
        printf ("%lld",lis[i]);
        if (i != lis.size()-1) printf(" ");
        else printf("\n");
    }
}

vector<vector<ll>> matrix_mul(vector<vector<ll>> A,vector<vector<ll>> B){
    vector<vector<ll>> ans(A.size(),vector<ll> (B[0].size(),0));

    rep(ai,0,A.size()){
        rep(bj,0,B[0].size()){

            ll now = 0;
            rep(same,0,A[0].size()){
                now += A[ai][same] * B[same][bj];
                now %= mod;
            }

            if (mod > 0){
                ans[ai][bj] = now % mod;
            }else{
                ans[ai][bj] = now;
            }
        }
    }

    return ans;
}

vector<vector<ll>> matrix_pow(vector<vector<ll>> A,ll x){
    vector<vector<ll>> B(A.size(),vector<ll> (A[0].size(),0));
    rep(i,0,A.size()){
        rep(j,0,A[0].size()){
            B[i][j] = A[i][j];
        }
    }

    vector<vector<ll>> ans(A.size(),vector<ll> (A[0].size(),0));
    rep(i,0,A.size()) ans[i][i] = 1;

    while (x > 0){
        if (x % 2 == 1){
            ans = matrix_mul(ans,B);
        }
        B = matrix_mul(B,B);
        x /= 2;
    }
    return ans;
}

int main(){

    ll N,M,K;
    cin >> N >> M >> K;

    vector<vector<ll>> A(1,vector<ll> (N));
    rep(i,0,N) cin >> A[0][i];

    vector<ll> enu(N,0);
    vector<vector<ll>> XY(0);

    rep(i,0,M){
        ll X,Y;
        cin >> X >> Y;
        X--;Y--;

        XY.push_back({X,Y});
        enu[X] += 1;
        enu[Y] += 1;
    }

    ll invM = inverse(M);
    ll half = inverse(2);

    vector<vector<ll>> H(N,vector<ll> (N,0));

    rep(i,0,N){
        H[i][i] += (M-enu[i]) * invM;
        H[i][i] %= mod;
        H[i][i] += ((enu[i] * invM) % mod) * half;
        H[i][i] %= mod;
    }

    rep(i,0,XY.size()){
        ll X,Y;
        X = XY[i][0]; Y = XY[i][1];

        H[X][Y] += (invM * half) % mod;
        H[Y][X] += (invM * half) % mod;
        H[X][Y] %= mod;
        H[Y][X] %= mod;

    }

    vector<vector<ll>> ans = matrix_mul(A,matrix_pow(H,K));
    rep(i,0,N){
        cout << ans[0][i] << '\n';
    }
}