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 char ch() {
  static char s[1 << 16], *S, *T;
  return (S == T) && (T = (S = s) + fread(s, 1, 1 << 16, stdin), S == T) ? EOF
                                                                         : *S++;
}
template <typename T>
void read(T &x) {
  x = 0;
  int f(1);
  char c = ch();
  for (; !isdigit(c); c = ch())
    if (c == '-') f = -1;
  for (; isdigit(c); c = ch()) x = x * 10 + c - '0';
  x *= f;
}
template <typename T>
void write(T x, int f = 1) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10, 0);
  putchar('0' + x % 10);
  if (f) puts("");
}
const int maxn = 505;
const double eps = 1e-10;
int n, m, K, tr[maxn], tot, sz;
int id[maxn], idf[maxn], xs[maxn * 2];
double V[maxn * 2][maxn * 2];
int deg[maxn], e[maxn][maxn];
struct Vector {
  double A[maxn];
  Vector() { memset(A, 0, sizeof A); }
} Vec[maxn];
Vector operator+(const Vector &y, const Vector &x) {
  Vector ret;
  for (int j(1); j <= sz; ++j) ret.A[j] = y.A[j] + x.A[j];
  return ret;
}
Vector operator-(const Vector &y, const Vector &x) {
  Vector ret;
  for (int j(1); j <= sz; ++j) ret.A[j] = y.A[j] - x.A[j];
  return ret;
}
Vector Mul(Vector x, double y) {
  Vector ret;
  for (int j(1); j <= sz; ++j) ret.A[j] = x.A[j] * y;
  return ret;
}
Vector Div(Vector x, double y) {
  Vector ret;
  for (int j(1); j <= sz; ++j) ret.A[j] = x.A[j] / y;
  return ret;
}
struct matrix {
  double A[maxn][maxn];
  matrix() { memset(A, 0, sizeof A); }
  void init() {
    for (int i(0); i <= sz; ++i) A[i][i] = 1;
  }
};
matrix operator*(const matrix &y, const matrix &x) {
  matrix ret;
  for (int i(0); i <= sz; ++i)
    for (int j(0); j <= sz; ++j)
      for (int k(0); k <= sz; ++k) ret.A[i][j] += y.A[i][k] * x.A[k][j];
  return ret;
}
matrix qp(matrix a, int b) {
  matrix ret;
  ret.init();
  while (b) {
    if (b & 1) ret = ret * a;
    a = a * a;
    b >>= 1;
  }
  return ret;
}
int main() {
  read(n);
  read(m);
  read(K);
  for (int i(1); i <= n; ++i) read(tr[i]), sz += tr[i];
  for (int i(1); i <= m; ++i) {
    int u, v;
    read(u);
    read(v);
    ++deg[u], ++deg[v];
    ++e[u][v];
    ++e[v][u];
  }
  for (int i(1); i <= n; ++i)
    if (tr[i]) id[++tot] = i, idf[i] = tot;
  for (int i(1); i <= n; ++i) {
    V[i][i] = -1;
    for (int j(1); j <= n; ++j)
      if (tr[j])
        V[i][idf[j] + n] += 1.0 * e[i][j] / deg[i];
      else
        V[i][j] += 1.0 * e[i][j] / deg[i];
  }
  for (int i(1); i <= tot; ++i) Vec[i + n].A[i] = 1.0, V[i + n][i + n] = 1.0;
  for (int i(1); i <= n + tot; ++i) {
    int mxj = -1;
    double mx = 0;
    for (int j(1); j <= n + tot; ++j)
      if (abs(V[i][j]) > mx) mx = abs(V[i][j]), mxj = j;
    if (mxj == -1 || mx <= eps) continue;
    xs[i] = mxj;
    double tmp = V[i][mxj];
    for (int j(1); j <= n + tot; ++j) V[i][j] /= tmp;
    Vec[i] = Div(Vec[i], tmp);
    for (int j(1); j <= n + tot; ++j) {
      if (j == i || abs(V[j][mxj]) <= eps) continue;
      tmp = V[j][mxj];
      for (int k(1); k <= n + tot; ++k) V[j][k] -= V[i][k] * tmp;
      Vec[j] = Vec[j] - Mul(Vec[i], tmp);
    }
  }
  matrix ans;
  for (int i(1); i <= n + tot; ++i)
    if (xs[i] == 1 || (xs[i] <= n && tr[xs[i]])) {
      if (xs[i] == 1) {
        for (int j(1); j <= tot; ++j) ans.A[0][j] = Vec[i].A[j];
      } else {
        for (int j(1); j <= tot; ++j) ans.A[idf[xs[i]]][j] = Vec[i].A[j];
      }
    }
  ans = qp(ans, K - 1);
  printf("%.8lf\n", ans.A[0][idf[n]]);
  return 0;
}