Problem: Today DZY begins to play an old game. In this game, he is in a big maze with n rooms connected by m corridors (each corridor allows to move in both directions). You can assume that all the rooms are connected with corridors directly or indirectly.

DZY has got lost in the maze. Currently he is in the first room and has k lives. He will act like the follows:

  * Firstly he will randomly pick one of the corridors going from his current room. Each outgoing corridor has the same probability to be picked. 
  * Then he will go through the corridor and then the process repeats. 



There are some rooms which have traps in them. The first room definitely has no trap, the n-th room definitely has a trap. Each time DZY enters one of these rooms, he will lost one life. Now, DZY knows that if he enters the n-th room with exactly 2 lives, firstly he will lost one live, but then he will open a bonus round. He wants to know the probability for him to open the bonus round. Please, help him.

Input

The first line contains three integers n, m, k (2 ≤ n ≤ 500; 1 ≤ m ≤ 105; 2 ≤ k ≤ 109).

The second line contains n integers, each of them is either 0 or 1. If the i-th number is 1, then the i-th room has a trap, otherwise it has not a trap. Please note, that the number of rooms with a trap is no more than 101. It is guaranteed that the first room has no trap, and the n-th room has a trap.

Then m lines follows. Each of them contains two integers ui, vi (1 ≤ ui, vi ≤ n; ui ≠ vi), meaning that current corridor connects two rooms ui and vi. It is guaranteed that the corridor system is connected.

Output

Print the only real number — the probability for DZY to open the bonus round. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4.

Examples

Input

5 5 3
0 0 1 0 1
1 2
2 3
3 4
4 5
1 2


Output

0.25000000


Input

3 2 2
0 1 1
1 2
2 3


Output

-0.00000000


Input

2 1 3
0 1
1 2


Output

1.00000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getchar());
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
const int MAXN = 500;
int n, m, K;
int G[MAXN + 5][MAXN + 5];
int is_trap[MAXN + 5], deg[MAXN + 5];
inline void input() {
  n = read<int>(), m = read<int>(), K = read<int>();
  for (int i = 1; i <= n; ++i) is_trap[i] = read<int>();
  for (int i = 1; i <= m; ++i) {
    int u = read<int>(), v = read<int>();
    ++G[u][v], ++G[v][u];
    ++deg[u], ++deg[v];
  }
}
inline void inv(int N, double A[MAXN + 5][MAXN + 5],
                double iA[MAXN + 5][MAXN + 5]) {
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j) iA[i][j] = i == j;
  for (int i = 1; i <= N; ++i) {
    double coef = A[i][i];
    for (int j = 1; j <= N; ++j) {
      A[i][j] /= coef;
      iA[i][j] /= coef;
    }
    for (int j = 1; j <= N; ++j)
      if (j != i) {
        coef = A[j][i];
        for (int k = 1; k <= N; ++k) {
          A[j][k] -= A[i][k] * coef;
          iA[j][k] -= iA[i][k] * coef;
        }
      }
  }
}
inline void mul(int N, double A[MAXN + 5][MAXN + 5],
                double B[MAXN + 5][MAXN + 5], double C[MAXN + 5][MAXN + 5]) {
  static double C0[MAXN + 5][MAXN + 5];
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j) C0[i][j] = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j)
      for (int k = 1; k <= N; ++k) C0[i][j] += A[i][k] * B[k][j];
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j) C[i][j] = C0[i][j];
}
inline void fpm(int N, double x[MAXN + 5][MAXN + 5], int y,
                double res[MAXN + 5][MAXN + 5]) {
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j) res[i][j] = i == j;
  for (; y; y >>= 1, mul(N, x, x, x))
    if (y & 1) mul(N, res, x, res);
}
inline void solve() {
  static double A[MAXN + 5][MAXN + 5], iA[MAXN + 5][MAXN + 5];
  for (int u = 1; u <= n; ++u) {
    A[u][u] = 1;
    for (int v = 1; v <= n; ++v)
      if (v != u && !is_trap[v] && G[v][u]) A[u][v] = (double)-G[v][u] / deg[v];
  }
  inv(n, A, iA);
  static double H[MAXN + 5][MAXN + 5];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) H[i][j] = iA[j][i];
  static int id[MAXN + 5], pos[MAXN + 5], N = 0;
  static double W[MAXN + 5][MAXN + 5];
  for (int i = 1; i <= n; ++i)
    if (is_trap[i]) pos[id[i] = ++N] = i;
  for (int u = 1; u <= n; ++u)
    if (is_trap[u]) {
      for (int v = 1; v <= n; ++v)
        if (v != u && G[u][v]) {
          if (!is_trap[v]) {
            for (int p = 1; p <= n; ++p)
              if (is_trap[p])
                W[id[u]][id[p]] += (double)G[u][v] / deg[u] * H[v][p];
          } else
            W[id[u]][id[v]] += (double)G[u][v] / deg[u];
        }
    }
  static double W0[MAXN + 5][MAXN + 5];
  fpm(N, W, K - 2, W0);
  double ans = 0;
  for (int i = 1; i <= N; ++i) ans += H[1][pos[i]] * W0[i][N];
  printf("%.6lf\n", ans);
}
int main() {
  input();
  solve();
  return 0;
}