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>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0;
  int b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int _ = 107, __ = 507, _e = 100007;
int pcnt = 0;
struct martix {
  double val[_][_];
  martix() { memset(val, 0, sizeof(val)); }
  void be0() { memset(val, 0, sizeof(val)); }
  void be1() {
    memset(val, 0, sizeof(val));
    for (int i = 1; i <= pcnt; i++) val[i][i] = 1;
  }
  double* operator[](int x) { return val[x]; }
  friend martix operator*(martix a, martix b) {
    martix c;
    for (int i = 1; i <= pcnt; i++)
      for (int j = 1; j <= pcnt; j++)
        for (int k = 1; k <= pcnt; k++) c[i][j] += a[i][k] * b[k][j];
    return c;
  }
};
martix powa(martix a, long long t) {
  martix b;
  b.be1();
  while (t) {
    if (t & 1) b = b * a;
    a = a * a, t >>= 1;
  }
  return b;
}
int n, m, hp;
int got[_] = {0}, who[__] = {0}, ea[_e], eb[_e], du[__] = {0};
double f[__][__ + _] = {0};
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  n = ty(), m = ty(), hp = ty();
  for (int i = 1; i <= n; i++)
    if (ty()) got[++pcnt] = i, who[i] = pcnt;
  for (int i = 1; i <= m; i++)
    ea[i] = ty(), eb[i] = ty(), du[ea[i]]++, du[eb[i]]++;
  for (int i = 1; i <= m; i++) {
    int a = ea[i], b = eb[i];
    if (!who[a])
      f[b][a] -= 1.00 / du[a];
    else
      f[b][n + who[a]] += 1.00 / du[a];
    if (!who[b])
      f[a][b] -= 1.00 / du[b];
    else
      f[a][n + who[b]] += 1.00 / du[b];
  }
  f[1][n + pcnt + 1] = 1;
  for (int i = 1; i <= n; i++) f[i][i] += 1;
  for (int i = 1; i <= n; i++) {
    int bias = i;
    for (int j = i; j <= n; j++)
      if (fabs(f[j][i]) > fabs(f[bias][i])) bias = j;
    if (i != bias)
      for (int j = i; j <= n + pcnt + 1; j++) swap(f[i][j], f[bias][j]);
    double fx = f[i][i];
    for (int j = 1; j <= n + pcnt + 1; j++) f[i][j] /= fx;
    for (int j = 1; j <= n; j++) {
      if (j == i) continue;
      double temp = f[j][i];
      for (int k = 1; k <= n + pcnt + 1; k++) f[j][k] -= f[i][k] * temp;
    }
  }
  martix bas, tran;
  for (int i = 1; i <= pcnt; i++)
    for (int j = 1; j <= pcnt; j++) tran[i][j] = f[got[j]][n + i];
  for (int i = 1; i <= pcnt; i++) bas[1][i] = f[got[i]][n + pcnt + 1];
  bas = bas * powa(tran, hp - 2);
  cout << setprecision(11) << fixed << bas[1][pcnt] << lf;
  return 0;
}