#include <bits/stdc++.h>
constexpr int DEBUG = 0;
using namespace std;
using int64 = long long;

struct Edge {
  int s, t;
  Edge(int s, int t) : s(s), t(t) {}
};

vector<vector<Edge>> ReadUndirectedGraph(int n, int m, int offset) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2; cin >> v1 >> v2; v1 -= offset; v2 -= offset;
    graph[v1].push_back(Edge(v1, v2)); graph[v2].push_back(Edge(v2, v1));
  }
  return graph;
}

class FF {
 private:
  int64 x_;
  void Normalize() {
    if (0 <= x_ && x_ < P) { return; } x_ %= P; if (x_ < 0) { x_ += P; }
  }
 public:
  // static constexpr int P = 998244353;
  static constexpr int P = 1000000007;
  FF(int64 x) : x_(x) { Normalize(); }
  FF() : x_(0) {}
  int64 Value() const { return x_; }
  FF operator+(FF o) const { FF r(*this); r += o; return r; }
  FF operator-(FF o) const { FF r(*this); r -= o; return r; }
  FF operator* (FF o) const { FF r(*this); r *= o; return r; }
  FF operator/ (FF o) const { return (*this) * o.Power(P - 2); }
  bool operator== (FF o) const { return x_ == o.x_; }
  void operator+= (FF o) { x_ += o.x_; if (x_ >= P) x_ -= P; }
  void operator-= (FF o) { x_ -= o.x_; if (x_ < 0) x_ += P; }
  void operator*= (FF o) { x_ = (x_ * o.x_) % P; }
  FF Power(int64 p) const {
    if (p < 0) { return FF(1) / Power(-p); } FF x(*this), r(1);
    while (p) { if (p % 2) { r *= x; } x *= x; p /= 2; } return r;
  }
};
ostream& operator<<(ostream& s, const FF& x) { s << x.Value(); return s; }

template<typename T>
vector<vector<T>> Make2D(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

vector<vector<FF>> Id(int n) {
  auto a = Make2D(n, n, FF(0));
  for (int i = 0; i < n; i++) { a[i][i] = 1; }
  return a;
}

vector<vector<FF>> Multiply(vector<vector<FF>> a, vector<vector<FF>> b) {
  int n = a.size();
  auto c = Make2D(n, n, FF(0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  return c;
}

vector<vector<FF>> Power(vector<vector<FF>> a, int p) {
  int n = a.size();
  vector<vector<FF>> r = Id(n);
  // while (p) { if (p % 2) { r *= x; } x *= x; p /= 2; } return r;
  while (p) {
    if (p % 2) {
      r = Multiply(r, a);
    }
    a = Multiply(a, a);
    p /= 2;
  }
  return r;
}


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, m, k; cin >> n >> m >> k;
  vector<FF> xs(n);
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    xs[i] = x;
  }
  auto graph = ReadUndirectedGraph(n, m, 1);

  auto a = Make2D(n, n, FF(0));
  for (int i = 0; i < n; i++) {
    a[i][i] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (const auto& e : graph[i]) {
      a[i][e.t] += FF(1) / FF(2 * m);
      a[i][i] -= FF(1) / FF(2 * m);
    }
  }

  // for (int i = 0; i < n; i++) {
  //   for (int j = 0; j < n; j++) {
  //     cout << a[i][j] * 4 << " ";
  //   }
  //   cout << endl;
  // }

  a = Power(a, k);

  // for (int i = 0; i < n; i++) {
  //   for (int j = 0; j < n; j++) {
  //     cout << a[i][j] << " ";
  //   }
  //   cout << endl;
  // }

  for (int i = 0; i < n; i++) {
    FF e = 0;
    for (int j = 0; j < n; j++) {
      e += a[i][j] * xs[j];
    }
    cout << e << endl;
  }
}

#include <bits/stdc++.h>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<double> VD;

#define MOD 1000000007

/* Matrix operations */

typedef int64 Element;
typedef vector<Element> Row;
typedef vector<Row> Matrix;

Matrix zeros(int h, int w) {
    return Matrix(h, Row(w));
}

Matrix identity(int n) {
    Matrix c = zeros(n,n);
    REP (i,n) c[i][i]=1;
    return c;
}

Matrix transpose(const Matrix &a) {
    int h=a[0].size(), w=a.size();
    Matrix t = zeros(h, w);
    REP (i,h) REP (j,w) t[i][j]=a[j][i];
    return t;
}

Matrix operator+(const Matrix &a, const Matrix &b) {
    int h=a.size(), w=a[0].size();
    assert(a.size()==b.size() && a[0].size()==b[0].size());
    Matrix c = zeros(h,w);
    REP (i,h) REP (j,w) {
        c[i][j]=a[i][j]+b[i][j];
        c[i][j]%=MOD;
    }
    return c;
}

Matrix operator+(const Matrix &a, Element k) {
    int h=a.size(), w=a[0].size();
    Matrix c = a;
    REP (i,h) REP (j,w) {
        c[i][j]+=k;
        c[i][j]%=MOD;
    }
    return c;
}

Matrix operator*(Element k, const Matrix &a) {
    int h=a.size(), w=a[0].size();
    Matrix c = a;
    REP (i,h) REP (j,w) {
        c[i][j]*=k;
        c[i][j]%=MOD;
    }
    return c;
}

Matrix operator*(const Matrix &a, const Matrix &b) {
    int h=a.size(), w=b[0].size();
    assert(a[0].size()==b.size());
    Matrix c = zeros(h,w);
    REP (i,h) REP (j,w) {
        REP (k,a[0].size()) {
            c[i][j]+=a[i][k]*b[k][j];
            c[i][j]%=MOD;
        }
    }
    return c;
}

Matrix operator+(Element k, const Matrix &a) {
    return a+k;
}

Matrix operator*(const Matrix &a, Element k) {
    return k*a;
}

Matrix operator-(const Matrix &a, const Matrix &b) {
    return a+(-1)*b;
}

Matrix mat_pow(const Matrix &a, int k) {
    assert(a.size()==a[0].size());
    if (k==0) return identity(a.size());
    if (k%2==0) {
        Matrix c=mat_pow(a,k/2);
        return c*c;
    } else {
        Matrix c=mat_pow(a,k-1);
        return c*a;
    }
}

void mat_print(const Matrix &a) {
    REP (i,a.size()) {
        REP (j,a[i].size()) {
            if (j!=0) cout << " ";
            cout << a[i][j];
        }
        cout << endl;
    }
}

int modPow(int a, int k, int m) {
	if (k==0) return 1;
	else if (k%2==0) {
		int64 b=modPow(a,k/2,m);
		return (b*b)%m;
	} else {
		int64 b=modPow(a,k-1,m);
		return (a*b)%m;
	}
}

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

int main() {
    //freopen("test.in","r",stdin);
    cin >> n >> m >> k;
    REP (i,n) cin >> a[i];
    Matrix A = zeros(n,n);
    REP (i,m) {
        int x,y;
        cin >> x >> y;
        x--; y--;
        adj[x].PB(y); adj[y].PB(x);
        deg[x]++; deg[y]++;
    }
    int64 inv_2m=modPow(2*m,MOD-2,MOD);
    int64 inv_m=modPow(m,MOD-2,MOD);
    REP (i,n) {
        for (int j : adj[i]) {
            A[i][j]=inv_2m; //1.0/(2*m);
            A[i][i]=(A[i][i]+inv_2m)%MOD; //+=1.0/(2*m);
        }
        A[i][i]=(A[i][i]+(m-deg[i])*inv_m)%MOD;
    }
    Matrix v = zeros(n,1);
    REP (i,n) v[i][0]=a[i];
    Matrix Ak = mat_pow(A,k);
    Matrix vk = Ak*v;
    REP (i,n) {
        cout << vk[i][0] << endl;
    }
    return 0;
}
