// 2021
#include <bits/stdc++.h>
#define rep(i, x, y) for(register int i = x; i < y; i++)
#define REP(i, x, y) for(register int i = x; i <= y; i++)
#define per(i, x, y) for(register int i = x; i > y; i--)
#define PER(i, x, y) for(register int i = x; i >= y; i--)
#define repl(i, x, y) for(register long long i = x; i < y; i++)
#define REPL(i, x, y) for(register long long i = x; i <= y; i++)
#define perl(i, x, y) for(register long long i = x; i > y; i--)
#define PERL(i, x, y) for(register long long i = x; i >= y; i--)
#define LLL __int128
#define int128 __int128
#define DEBUG(x) cerr << #x << " : " << x << endl
using namespace std;
typedef unsigned int uint;
typedef long long int64;
typedef long long LL;
typedef unsigned long long uint64;
typedef unsigned long long ULL;
typedef long double LLF;
inline void NO() { cout << "NO\n"; }
inline void YES() { cout << "YES\n"; }
inline void NEG() { cout << "-1\n"; }
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; }
template<typename T> inline void read(T &val)
{
	val = 0; char c = getchar(); int f = 1;
	while(!isdigit(c)) { if(c == '-') f = -1; c = getchar(); }
	while(isdigit(c)) { val = (val << 3) + (val << 1) + (c ^ 48); c = getchar(); }
	val *= f;
}
template<typename T> void write_(T val) { if(!val) return; write_(val / 10); putchar(val % 10 + 48); }
template<typename T> inline void write(T val)
{
	if(val == 0) putchar(48);
	else if(val < 0) { putchar('-'); write_(-val); }
	else write_(val);
}

#define int long long

const int MOD = 1e9 + 7, N = 1e5 + 5;
int n, a[N], f[N][2], g[N][2];

signed main()
{
#ifdef LOCAL
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin >> n;
	REP(i, 1, n) cin >> a[i];
	if(n == 1)
	{
		cout << a[1] << endl;
		return 0;
	}
	g[1][0] = (a[1] - a[2] + MOD) % MOD;
	g[1][1] = (a[1] + a[2]) % MOD; // 0 = -
	f[1][0] = f[1][1] = 1;
	rep(i, 2, n)
	{
		f[i][0] = f[i - 1][1];
		g[i][0] = (g[i - 1][1] - (LL)f[i][0] * a[i + 1] % MOD + MOD) % MOD;
		f[i][1] = (f[i - 1][0] + f[i - 1][1]) % MOD;
		g[i][1] = ((g[i - 1][0] + g[i - 1][1]) % MOD + (LL)f[i][1] * a[i + 1] % MOD) % MOD;
	}
	cout << (g[n - 1][0] + g[n - 1][1]) % MOD << endl;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vc<vc<T>>;
template<class T> using vvvc = vc<vvc<T>>;
template<class T> using vvvvc = vvc<vvc<T>>;
template<class T> using PQ = priority_queue<T>;
template<class T> using invPQ = priority_queue<T, vector<T>, greater<T>>;
using IP = pair<int, int>;
using LP = pair<ll, ll>;
#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define rep3(i, m, n) for (int i = (m); (i) < (int)(n); i++)
#define repr(i, n) for (int i = n; (i) >= 0; i--)
#define rep3r(i, m, n) for (int i = (n); (i) >= (int)(m); i--)
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }
// constexpr int INF = 1070000000;
// constexpr long long LINF = 4611686015206162431;
constexpr int MOD = 1000000007;
// constexpr long double PI = 3.1415926535897932;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

using vec = vector<ll>;
using mat = vector<vector<ll>>;

mat matmul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    rep (i, A.size()) {
        rep (k, A[0].size()) {
            rep (j, B[0].size()) {
                C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
            }
        }
    }
    return C;
}

mat matpow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    rep (i, A.size()) B[i][i] = 1;
    while (n > 0) {
        if (n & 1) B = matmul(B, A);
        A = matmul(A, A);
        n >>= 1;
    }
    return B;
}

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

    int N, M, K;
    cin >> N >> M >> K;
    mat A(1, vec(N));
    rep (i, N) cin >> A[0][i];
    vvc<int> graph(N);
    rep (i, M) {
        int X, Y;
        cin >> X >> Y;
        X--; Y--;
        graph[X].push_back(Y);
        graph[Y].push_back(X);
    }

    ll invm = modinv(M, MOD), inv2 = modinv(2, MOD);

    mat B(N, vec(N));
    
    rep (j, N) {
        for (int i : graph[j]) {
            B[i][j] = invm * inv2 % MOD;
        }
        B[j][j] = ((M - graph[j].size() + inv2 * graph[j].size()) % MOD) * invm % MOD;
    }

    B = matpow(B, K);
    A = matmul(A, B);
    rep (i, N) {
        cout << A[0][i] << endl;
    }
}