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

#define all(x) (x).begin(), (x).end()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

long long f(long long n, long long s) {
  long long x = min(n, s - 1);
  return x - (s - x) + 1;
}

int main() {
  _upgrade;
  long long N, K;
  cin >> N >> K;

  long long res = 0;
  for (long long s = max(K + 2, 2LL); s <= 2 * N; s++) {
    if (s - K >= 2 && s - K <= 2 * N) {
      res += f(N, s) * f(N, s - K);
    }
  }

  cout << res << "\n";
  return 0;
}
#include <bits/stdc++.h>
#define F first
#define S second
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define bck(i, a, b) if ((i) >= (a) && (i) < (b))
#define trav(x, a) for (auto &x : (a))
#define sz(a) (int)(a).size()
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef string str;
template<typename T> using vec = vector<T>;
template<typename T> using pq = priority_queue<T, vector<T>, std::greater<T>>;
template<typename T> using mxpq = priority_queue<T>;
typedef pair<int,int> pii;
typedef vec<int> vi;
typedef vec<pii> vii;
typedef vec<vi> vvi;
typedef pair<ll,ll> pll;
typedef vec<ll> vl;
typedef vec<pll> vll;
typedef vec<vl> vvl;
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<typename A, typename B>
istream& operator>>(istream& s, pair<A,B>& p) { return s>>p.first>>p.second; }
template<typename T>
istream& operator>>(istream& s, vec<T>& p) {
    for (T& t : p) s >> t;
    return s;
}

#define MOD 1000000007ll

vl mmul(const vl& a, const vl& b, int n) {
    vl r(sz(b));
    rep(i, 0, n) rep(k, 0, n) rep(j, 0, n)
        (r[i*n+j] += a[i*n+k] * b[k*n+j] % MOD) %= MOD;
    return r;
}
vl vmul(const vl& a, const vl& b, int n) {
    vl r(sz(b));
    rep(i, 0, n) rep(j, 0, n)
        (r[i] += a[i*n+j] * b[j] % MOD) %= MOD;
    return r;
}

ll modpow(ll b, ll e, ll mod=MOD) {
    if (e < 0) return modpow(modpow(b, mod-2, mod), -e, mod);
    ll r = 1;
    while (e) {
        if (e & 1) r = r*b % mod;
        b = b*b % mod;
        e /= 2;
    }
    return r;
}

ll modinv(ll n, ll mod=MOD) { return modpow(n, mod-2, mod); }

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n, m, k; cin >> n >> m >> k;
    vl a(n), mat(n*n); cin >> a;
    rep(i, 0, n) mat[i*n+i] = 1;
    rep(i, 0, m) {
        int x, y; cin >> x >> y; x--, y--;
        (mat[x*n+x] -= modinv(m)*modinv(2) % MOD) %= MOD;
        (mat[y*n+y] -= modinv(m)*modinv(2) % MOD) %= MOD;
        (mat[x*n+y] += modinv(m)*modinv(2) % MOD) %= MOD;
        (mat[y*n+x] += modinv(m)*modinv(2) % MOD) %= MOD;
    }
    trav(v, mat) (v += MOD) %= MOD;
    while (k) {
        if (k & 1) a = vmul(mat, a, n);
        mat = mmul(mat, mat, n);
        k >>= 1;
    }
    trav(v, a) cout << v << endl;
}
