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;
double P[5001][5001];
double Aux[125][125], C[125][125];
int eh[5001];
int grau[5001];
int del[5001];
int trap[5001];
int K;
int n;
void mul(double A[125][125], double B[125][125]) {
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++) Aux[i][j] = 0;
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++)
      for (int k = 0; k < K; k++) {
        Aux[i][j] += A[i][k] * B[k][j];
      }
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++) C[i][j] = Aux[i][j];
}
void exp(double M[125][125], int b) {
  if (b == 0) {
    memset(C, 0, sizeof C);
    for (int i = 0; i < n; i++) C[i][i] = 1;
    return;
  }
  exp(M, b / 2);
  mul(C, C);
  if (b % 2 == 1) mul(C, M);
}
void remove_self(int v) {
  double p = P[v][v];
  if (fabs(p) < 1e-9) return;
  p = 1. - p;
  P[v][v] = 0;
  for (int i = 0; i < n; i++) P[v][i] /= p;
}
void contrai2(int v) {
  double self = P[v][v];
  for (int a = 0; a < n; ++a) {
    if (a == v) continue;
    for (int b = 0; b < n; ++b) {
      if (b == v) continue;
      P[a][b] += P[a][v] * P[v][b] / (1 - self);
    }
  }
  for (int a = 0; a < n; ++a) P[a][v] = P[v][a] = 0;
}
void contrai(int v) {
  vector<int> aux;
  remove_self(v);
  for (int x = 0; x < n; x++)
    if (x != v) {
      for (int y = 0; y < n; y++)
        if (y != v) {
          P[x][y] += P[x][v] * P[v][y];
        }
      P[x][v] = 0;
    }
  del[v] = 1;
}
vector<int> T;
double M[125][125];
double ini[125];
int main() {
  int mortes;
  int m;
  cin >> n >> m >> mortes;
  for (int i = 0; i < n; i++) {
    cin >> trap[i];
    if (trap[i]) T.push_back(i);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    P[a][b] += 1., P[b][a] += 1.;
    grau[a]++, grau[b]++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      P[i][j] = P[i][j] / (double)grau[i];
    }
  }
  K = T.size();
  for (int i = 1; i < n; i++)
    if (!trap[i]) {
      contrai(i);
    }
  remove_self(0);
  for (int i = 0; i < T.size(); i++) ini[i] = P[0][T[i]];
  contrai(0);
  for (int i = 0; i < T.size(); i++)
    for (int j = 0; j < T.size(); j++) {
      M[i][j] = P[T[i]][T[j]];
    }
  exp(M, mortes - 2);
  double ans = 0;
  for (int i = 0; i < K; i++) ans += ini[i] * C[i][K - 1];
  printf("%.20f\n", ans);
  return 0;
}