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;
int n, m, K, tot;
double f[510][610];
int dan[510], d[510], p[510], pa[100010], pb[100010];
struct M {
  double v[105][105];
  M() { memset(v, 0, sizeof(v)); }
  double *operator[](const int &a) { return v[a]; }
  inline M operator*(const M &a) const {
    M b;
    int i, j, k;
    for (i = 1; i <= tot; i++)
      for (j = 1; j <= tot; j++)
        for (k = 1; k <= tot; k++) b.v[i][j] += v[i][k] * a.v[k][j];
    return b;
  }
} S, T;
inline void pm(int y) {
  while (y) {
    if (y & 1) S = S * T;
    T = T * T, y >>= 1;
  }
}
inline int rd() {
  int ret = 0, f = 1;
  char gc = getchar();
  while (gc < '0' || gc > '9') {
    if (gc == '-') f = -f;
    gc = getchar();
  }
  while (gc >= '0' && gc <= '9') ret = ret * 10 + (gc ^ '0'), gc = getchar();
  return ret * f;
}
int main() {
  n = rd(), m = rd(), K = rd();
  int i, j, k, a, b;
  for (i = 1; i <= n; i++) {
    dan[i] = rd();
    if (dan[i]) dan[i] = ++tot, p[tot] = i;
  }
  for (i = 1; i <= m; i++) pa[i] = rd(), pb[i] = rd(), d[pa[i]]++, d[pb[i]]++;
  for (i = 1; i <= m; i++) {
    a = pa[i], b = pb[i];
    if (!dan[a])
      f[b][a] -= 1.0 / d[a];
    else
      f[b][dan[a] + n] += 1.0 / d[a];
    if (!dan[b])
      f[a][b] -= 1.0 / d[b];
    else
      f[a][dan[b] + n] += 1.0 / d[b];
  }
  f[1][n + tot + 1] = 1;
  for (i = 1; i <= n; i++) f[i][i] += 1;
  for (i = 1; i <= n; i++) {
    for (j = k = i; j <= n; j++)
      if (fabs(f[j][i]) > fabs(f[k][i])) k = j;
    if (i != k)
      for (j = i; j <= n + tot + 1; j++) swap(f[i][j], f[k][j]);
    double tmp = f[i][i];
    for (j = i; j <= n + tot + 1; j++) f[i][j] /= tmp;
    for (j = 1; j <= n; j++)
      if (j != i) {
        tmp = f[j][i];
        for (k = 1; k <= n + tot + 1; k++) f[j][k] -= f[i][k] * tmp;
      }
  }
  for (i = 1; i <= tot; i++)
    for (j = 1; j <= tot; j++) T[i][j] = f[p[j]][i + n];
  for (i = 1; i <= tot; i++) S[1][i] = f[p[i]][n + tot + 1];
  pm(K - 2);
  printf("%.10lf", S[1][tot]);
  return 0;
}