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;
const int N = 510, M = 110;
int a[N], n, m;
double b[N][N], d[N];
double A[N][N], C[N][N];
inline double ab(double x) { return x < 0 ? -x : x; }
void build() {
  for (int i = 1; i <= n; i++)
    if (a[i])
      A[i][i] = 1;
    else {
      A[i][i] = 1;
      for (int j = 1; j <= n; j++)
        if (j != i) A[i][j] = -b[i][j];
    }
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++)
      if (a[i]) C[i][j] = (i == j);
}
void solve(double a[][N], double c[][N]) {
  for (int i = 1; i <= n; i++) {
    int t = i;
    for (int j = i + 1; j <= n; j++)
      if (ab(a[j][i]) > ab(a[t][i])) t = j;
    for (int j = 1; j <= n; j++) swap(a[i][j], a[t][j]), swap(c[i][j], c[t][j]);
    for (int j = 1; j <= n; j++)
      if (j != i) {
        double f = a[j][i] / a[i][i];
        for (int k = 1; k <= n; k++)
          a[j][k] -= f * a[i][k], c[j][k] -= f * c[i][k];
      }
    double f = a[i][i];
    for (int j = 1; j <= n; j++) a[i][j] /= f, c[i][j] /= f;
  }
}
double f[M][M], g[M][M];
int id[N], l = 0;
void mult(double a[][M], const double b[][M]) {
  static double c[M][M];
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= l; i++)
    for (int k = 1; k <= l; k++)
      for (int j = 1; j <= l; j++) c[i][j] += a[i][k] * b[k][j];
  for (int i = 1; i <= l; i++)
    for (int j = 1; j <= l; j++) a[i][j] = c[i][j];
}
void pw(double a[][M], int b) {
  static double w[M][M];
  for (int i = 1; i <= l; i++)
    for (int j = 1; j <= l; j++) w[i][j] = (i == j);
  for (; b; b >>= 1, mult(a, a))
    if (b & 1) mult(w, a);
  for (int i = 1; i <= l; i++)
    for (int j = 1; j <= l; j++) a[i][j] = w[i][j];
}
int main() {
  int k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    b[x][y]++, b[y][x]++, d[x]++, d[y]++;
  }
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= n; y++) b[x][y] /= d[x];
  build(), solve(A, C);
  for (int i = 1; i <= n; i++)
    if (a[i]) id[i] = ++l;
  for (int i = 1; i <= n; i++)
    if (a[i])
      for (int j = 1; j <= n; j++)
        if (a[j]) {
          f[id[i]][id[j]] = 0;
          for (int k = 1; k <= n; k++) f[id[i]][id[j]] += b[i][k] * C[k][j];
        }
  pw(f, k - 2);
  for (int i = 1; i <= n; i++)
    if (a[i]) g[1][id[i]] = C[1][i];
  mult(g, f);
  printf("%.9lf\n", g[1][l]);
  return 0;
}