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;
const int MOD = 1000000007;
const int INF = 100000000;
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
long long fastMin(long long x, long long y) {
  return (((y - x) >> (64 - 1)) & (x ^ y)) ^ x;
}
long long fastMax(long long x, long long y) {
  return (((y - x) >> (64 - 1)) & (x ^ y)) ^ y;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
vector<vector<double>> mul(const vector<vector<double>>& a,
                           const vector<vector<double>>& b) {
  int n = a.size();
  int m = a[0].size();
  int x = b.size();
  int y = b[0].size();
  assert(m == x);
  vector<vector<double>> c(n, vector<double>(y));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < y; ++j)
      for (int k = 0; k < m; ++k) (c[i][j] += a[i][k] * b[k][j]);
  return c;
}
vector<vector<double>> pow(const vector<vector<double>>& _a, int e) {
  vector<vector<double>> a = _a;
  int n = a.size();
  vector<vector<double>> res(n, vector<double>(n));
  for (int i = 0; i < n; ++i) res[i][i] = 1;
  while (e > 0) {
    if (e & 1) res = mul(res, a);
    a = mul(a, a);
    e /= 2;
  }
  return res;
}
vector<vector<double>> inv(vector<vector<double>> A) {
  assert(((int)(A).size()) == ((int)(A[0]).size()));
  const int n = ((int)(A).size());
  vector<vector<double>> B(n, vector<double>(n));
  for (int i = 0; i < (n); i++) B[i][i] = 1;
  for (int k = 0; k < (n); k++) {
    int pv = k;
    for (int i = k + 1; i < n; ++i) {
      if (abs(A[i][k]) > abs(A[pv][k])) pv = i;
    }
    for (int j = 0; j < n; ++j) {
      swap(A[k][j], A[pv][j]);
      swap(B[k][j], B[pv][j]);
    }
    double e = A[k][k];
    for (int j = 0; j < (n); j++) {
      A[k][j] /= e;
      B[k][j] /= e;
    }
    for (int i = k + 1; i < n; ++i) {
      double x = A[i][k];
      for (int j = 0; j < (n); j++) {
        A[i][j] -= A[k][j] * x;
        B[i][j] -= B[k][j] * x;
      }
    }
  }
  for (int k = n - 1; k >= 0; --k) {
    for (int i = 0; i < k; ++i) {
      double e = A[i][k];
      for (int j = 0; j < n; ++j) {
        A[i][j] -= A[k][j] * e;
        B[i][j] -= B[k][j] * e;
      }
    }
  }
  return B;
}
void print(vector<vector<double>>& x) {
  for (int i = 0; i < (((int)(x).size())); i++) {
    for (int j = 0; j < (((int)(x[i]).size())); j++) printf("%lf ", x[i][j]);
    puts("");
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  vector<int> trips;
  for (int i = 0; i < (n); i++)
    if (a[i]) trips.push_back(i);
  const int Bsize = ((int)(trips).size());
  vector<vector<int>> e(n, vector<int>(n));
  for (int i = 0; i < (m); i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    e[a][b]++;
    e[b][a]++;
  }
  vector<vector<double>> A(n, vector<double>(n));
  for (int i = 0; i < (n); i++) {
    if (a[i] == 1) {
      continue;
    }
    double s = accumulate(e[i].begin(), e[i].end(), 0);
    for (int j = 0; j < (n); j++) {
      A[i][j] = e[i][j] / s;
    }
  }
  vector<vector<double>> Adash(n, vector<double>(n));
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (n); j++) Adash[i][j] = -A[i][j];
  for (int i = 0; i < (n); i++) Adash[i][i] += 1;
  vector<vector<double>> Adash_inv = inv(Adash);
  vector<vector<double>> B;
  for (int i = 0; i < (n); i++) {
    if (!a[i]) continue;
    vector<vector<double>> c(1);
    double s = accumulate(e[i].begin(), e[i].end(), 0);
    for (int j = 0; j < (n); j++) {
      c[0].push_back(e[i][j] / s);
    }
    int tmp = 0;
    auto c2 = mul(c, Adash_inv);
    vector<double> r;
    for (int j = 0; j < (n); j++) {
      if (!a[j]) continue;
      r.push_back(c2[0][j]);
    }
    B.push_back(r);
  }
  vector<vector<double>> start(1);
  for (int i = 0; i < (n); i++) {
    if (!a[i]) continue;
    start[0].push_back(Adash_inv[0][i]);
  }
  vector<vector<double>> C = pow(B, k - 2);
  vector<vector<double>> D = mul(start, C);
  double ans = D[0].back();
  printf("%.10lf\n", ans);
}