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;
namespace matrix {
template <int N, int M>
class matr {
 public:
  double dat[N][M];
  void init() { memset(dat, 0, sizeof(dat)); }
  void iden() {
    init();
    for (int i = 0; i < min(N, M); i++) dat[i][i] = 1;
  }
  matr<M, N> trans() {
    matr<M, N> out;
    for (int i = 0; i < M; i++)
      for (int j = 0; j < N; j++) out[i][j] = dat[j][i];
  }
  const double *operator[](const int &x) const { return dat[x]; }
  double *operator[](const int &x) { return dat[x]; }
  template <int X>
  friend matr<N, M> operator*(const matr<N, X> a, const matr<X, M> b) {
    matr<N, M> out;
    out.init();
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < X; j++) {
        if (a[i][j] != 0) {
          for (int k = 0; k < M; k++) out[i][k] += a[i][j] * b[j][k];
        }
      }
    }
    return out;
  }
};
};  // namespace matrix
using namespace matrix;
int n, m, K, flag[510], id[510];
vector<int> special;
double a[510][510], lft[510];
vector<pair<pair<int, int>, double> > opt;
vector<int> v[510];
void gauss() {
  for (int i = 1; i <= n; i++) {
    int pos = -1;
    for (int j = i; j <= n; j++) {
      if (fabs(a[j][i]) > 1e-12) {
        pos = j;
        break;
      }
    }
    assert(pos != -1);
    swap(id[pos], id[i]);
    for (int j = 1; j <= n; j++) swap(a[pos][j], a[i][j]);
    for (int j = 1; j <= n; j++) {
      if (j != pos) {
        double dlt = a[j][i] / a[pos][i];
        opt.push_back(make_pair(make_pair(id[j], id[pos]), dlt));
        for (int k = 1; k <= n; k++) a[j][k] -= a[pos][k] * dlt;
      }
    }
  }
}
double cur[510];
void solve() {
  for (auto &x : opt) cur[x.first.first] -= cur[x.first.second] * x.second;
  for (int i = 1; i <= n; i++) {
    cur[id[i]] /= a[i][i];
  }
}
matr<110, 110> g;
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &flag[i]);
    if (flag[i]) special.push_back(i);
  }
  for (int i = 1, ti, tj; i <= m; i++) {
    scanf("%d%d", &ti, &tj);
    v[ti].push_back(tj);
    v[tj].push_back(ti);
  }
  for (int i = 1; i <= n; i++) {
    id[i] = i;
    double bas = 1.0 / v[i].size();
    for (auto &x : v[i]) {
      if (!flag[x]) a[i][x] -= bas;
    }
    a[i][i] = 1;
  }
  gauss();
  matr<1, 110> ans;
  ans.init();
  for (int i = 0; i < special.size(); i++) {
    int x = special[i];
    memset(cur, 0, sizeof(cur));
    for (auto &y : v[x]) cur[y] += 1.0 / v[y].size();
    solve();
    ans[0][i] = cur[id[1]];
    for (int j = 0; j < special.size(); j++) g[j][i] = cur[id[special[j]]];
  }
  K -= 2;
  while (K) {
    if (K & 1) ans = ans * g;
    g = g * g;
    K >>= 1;
  }
  printf("%.10lf\n", ans[0][special.size() - 1]);
  return 0;
}