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;
template <typename T1, typename T2>
void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
namespace fastio {
char rbuf[1 << 23], *p1 = rbuf, *p2 = rbuf, wbuf[1 << 23], *p3 = wbuf;
inline char getc() {
  return p1 == p2 &&
                 (p2 = (p1 = rbuf) + fread(rbuf, 1, 1 << 23, stdin), p1 == p2)
             ? -1
             : *p1++;
}
inline void putc(char x) { (*p3++ = x); }
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  T neg = 0;
  while (!isdigit(c)) neg |= !(c ^ '-'), c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (neg) x = (~x) + 1;
}
template <typename T>
void recursive_print(T x) {
  if (!x) return;
  recursive_print(x / 10);
  putc(x % 10 ^ 48);
}
template <typename T>
void print(T x) {
  if (!x) putc('0');
  if (x < 0) putc('-'), x = ~x + 1;
  recursive_print(x);
}
void print_final() { fwrite(wbuf, 1, p3 - wbuf, stdout); }
}  // namespace fastio
const int MAXN = 500;
const int MAXM = 101;
const int TOT = 601;
int n, m, k, deg[MAXN + 5], num[MAXN + 5][MAXN + 5];
bool is[MAXN + 5];
int rm[MAXN + 5], id[MAXN + 5], cnt = 0;
double a[MAXN + 5][TOT + 5], f[MAXN + 5][MAXM + 5];
struct mat {
  double a[MAXM + 5][MAXM + 5];
  mat() {
    for (int i = 1; i <= MAXM; i++)
      for (int j = 1; j <= MAXM; j++) a[i][j] = 0;
  }
  mat operator*(const mat &rhs) {
    mat ret;
    for (int i = 1; i <= cnt; i++)
      for (int j = 1; j <= cnt; j++)
        for (int l = 1; l <= cnt; l++) ret.a[i][j] += a[i][l] * rhs.a[l][j];
    return ret;
  }
};
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &is[i]);
    if (is[i]) rm[++cnt] = i, id[i] = cnt;
  }
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d%d", &u, &v);
    deg[u]++;
    deg[v]++;
    num[u][v]++;
    num[v][u]++;
  }
  for (int i = 1; i <= n; i++) {
    if (!is[i]) {
      a[i][i] = -1;
      for (int j = 1; j <= n; j++)
        if (i ^ j) a[i][j] = 1.0 * num[i][j] / deg[i];
    } else {
      a[i][i] = a[i][id[i] + n] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    int pos = i;
    for (int j = i + 1; j <= n; j++)
      if (fabs(a[j][i]) > fabs(a[pos][i])) pos = j;
    for (int j = i; j <= n + cnt; j++) swap(a[pos][j], a[i][j]);
    for (int j = i + 1; j <= n + cnt; j++) a[i][j] /= a[i][i];
    a[i][i] = 1;
    for (int j = i + 1; j <= n; j++) {
      for (int k = i + 1; k <= n + cnt; k++) a[j][k] -= a[i][k] * a[j][i];
      a[j][i] = 0;
    }
  }
  for (int i = 1; i <= cnt; i++)
    for (int j = n; j; j--) {
      f[j][i] = a[j][i + n];
      for (int k = j + 1; k <= n; k++) f[j][i] -= a[j][k] * f[k][i];
    }
  mat trs, ini, mul;
  for (int i = 1; i <= cnt; i++)
    for (int j = 1; j <= cnt; j++) {
      for (int l = 1; l <= n; l++)
        trs.a[j][i] += 1.0 * num[rm[i]][l] / deg[rm[i]] * f[l][j];
    }
  for (int i = 1; i <= cnt; i++) ini.a[i][1] = f[1][i];
  k -= 2;
  for (int i = 1; i <= cnt; i++) mul.a[i][i] = 1;
  for (; k; k >>= 1, trs = trs * trs)
    if (k & 1) mul = mul * trs;
  ini = mul * ini;
  printf("%.10lf\n", ini.a[cnt][1]);
  return 0;
}