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 void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
int n, m, i, j, k, kk, typ[505], ban[105], cnt, id[505];
int deg[505], px[100005], py[100005];
double f[505][605];
struct mat {
  double a[105][105];
} s, t;
mat mul(mat x, mat y) {
  mat z;
  int i, j, k;
  for (((i)) = (1); ((i)) <= ((cnt)); ((i))++)
    for (((j)) = (1); ((j)) <= ((cnt)); ((j))++) {
      z.a[i][j] = 0;
      for (((k)) = (1); ((k)) <= ((cnt)); ((k))++) {
        z.a[i][j] += x.a[i][k] * y.a[k][j];
      }
    }
  return z;
}
mat pw(mat x, int y, mat z) {
  while (y) {
    if (y & 1) z = mul(z, x);
    x = mul(x, x);
    y /= 2;
  }
  return z;
}
int main() {
  scanf("%d%d%d", &n, &m, &kk);
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    scanf("%d", &typ[i]);
    if (typ[i]) {
      ban[++cnt] = i;
      id[i] = cnt;
    }
  }
  for (((i)) = (1); ((i)) <= ((m)); ((i))++) {
    scanf("%d%d", &px[i], &py[i]);
    deg[px[i]]++;
    deg[py[i]]++;
  }
  for (((i)) = (1); ((i)) <= ((m)); ((i))++) {
    if (id[px[i]]) {
      f[py[i]][id[px[i]] + n] += 1.0 / deg[px[i]];
    } else {
      f[py[i]][px[i]] -= 1.0 / deg[px[i]];
    }
    if (id[py[i]]) {
      f[px[i]][id[py[i]] + n] += 1.0 / deg[py[i]];
    } else {
      f[px[i]][py[i]] -= 1.0 / deg[py[i]];
    }
  }
  f[1][n + cnt + 1] = 1;
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) f[i][i] = 1;
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    int t = i;
    for ((j) = (i + 1); (j) <= (n); (j)++) {
      if (abs(f[j][i]) > abs(f[t][i])) {
        t = j;
      }
    }
    for (((k)) = (1); ((k)) <= ((n + cnt + 1)); ((k))++) {
      swap(f[i][k], f[t][k]);
    }
    double coef = f[i][i];
    for (((j)) = (1); ((j)) <= ((n + cnt + 1)); ((j))++) f[i][j] /= coef;
    for (((j)) = (1); ((j)) <= ((n)); ((j))++)
      if (j != i) {
        double coef = f[j][i] / f[i][i];
        for (((k)) = (1); ((k)) <= ((n + cnt + 1)); ((k))++) {
          f[j][k] -= f[i][k] * coef;
        }
      }
  }
  for (((i)) = (1); ((i)) <= ((cnt)); ((i))++)
    for (((j)) = (1); ((j)) <= ((cnt)); ((j))++) {
      t.a[i][j] = f[ban[j]][i + n];
    }
  for (((i)) = (1); ((i)) <= ((cnt)); ((i))++) {
    s.a[1][i] = f[ban[i]][n + cnt + 1];
  }
  t = pw(t, kk - 2, s);
  printf("%.10f\n", t.a[1][cnt]);
  return 0;
}