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 int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct Matrix {
  double s[500 + 5][500 + 5];
  Matrix() { memset(s, 0, sizeof(s)); }
  Matrix operator*(const Matrix& b) {
    Matrix c;
    for (int i = 1; i <= 101; ++i)
      for (int j = 1; j <= 101; ++j)
        for (int k = 1; k <= 101; ++k) c.s[i][j] += s[i][k] * b.s[k][j];
    return c;
  }
} A, B;
int n, m, k, Kind[500 + 5], b[500 + 5][500 + 5], du[500 + 5],
    top = 0, tot = 0, pos[500 + 5], id[500 + 5];
double a[500 + 5][500 + 5], res[500 + 5];
struct op {
  int kind, l, r;
  double s;
} q[500 * 500 + 5];
void Gauss() {
  a[1][n + 1] += 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j)
      if (fabs(a[j][i]) > 1e-11) {
        if (j != i) {
          for (int k = i; k <= n + 1; ++k) swap(a[i][k], a[j][k]);
          q[++top] = (op){1, i, j, 0};
        }
        break;
      }
    if (fabs(a[i][i]) < 1e-11) continue;
    for (int j = i + 1; j <= n; ++j) {
      double s = a[j][i] / a[i][i];
      q[++top] = (op){2, i, j, s};
      for (int k = i; k <= n + 1; ++k) a[j][k] -= a[i][k] * s;
    }
  }
  res[n] = a[n][n + 1];
  for (int i = n - 1; i; --i) {
    double t = a[i][n + 1];
    for (int j = i + 1; j <= n; ++j) t -= a[i][j] * res[j];
    res[i] = t / a[i][i];
  }
}
void Solve(int x) {
  for (int i = 1; i <= n; ++i) id[i] = i;
  for (int j = 1; j <= n; ++j) res[j] = (double)b[x][j] / du[x];
  for (int i = 1; i <= top; ++i)
    if (q[i].kind == 1)
      swap(id[q[i].l], id[q[i].r]);
    else
      res[id[q[i].r]] -= q[i].s * res[id[q[i].l]];
  for (int i = n - 1; i; --i) {
    double t = res[i];
    for (int j = i + 1; j <= n; ++j) t -= a[i][j] * res[j];
    res[i] = t / a[i][i];
  }
}
int main() {
  n = read();
  m = read();
  k = read();
  for (int i = 1; i <= n; ++i)
    if (Kind[i] = read()) pos[i] = ++tot;
  for (int i = 1; i <= m; ++i) {
    int x = read(), y = read();
    ++du[x];
    ++du[y];
    ++b[x][y];
    ++b[y][x];
  }
  for (int i = 1; i <= n; ++i) ++a[i][i];
  for (int i = 1; i <= n; ++i)
    if (!Kind[i])
      for (int j = 1; j <= n; ++j) a[j][i] -= (double)b[i][j] / du[i];
  Gauss();
  for (int i = 1; i <= n; ++i)
    if (Kind[i]) B.s[pos[i]][1] = res[i];
  for (int i = 1; i <= n; ++i)
    if (Kind[i]) {
      Solve(i);
      for (int j = 1; j <= n; ++j)
        if (Kind[j]) A.s[pos[j]][pos[i]] = res[j];
    }
  for (k -= 2; k; k >>= 1, A = A * A)
    if (k & 1) B = A * B;
  printf("%.10lf\n", B.s[pos[n]][1]);
  return 0;
}