#include <bits/stdc++.h>
using namespace std;
const int NMax = 505;
int N, M, K;
double Res[NMax], Prob[NMax][NMax], Sol[NMax][NMax], P[NMax][NMax],
    Aux[NMax][NMax], Coef[NMax][NMax], S[NMax][NMax], tProb[NMax][NMax];
int Trap[NMax];
vector<int> G[NMax];
struct Operation {
  int type;
  int x, y;
  double mul, add;
} Op[NMax * NMax * 4];
int Ord[NMax], tCells[NMax], cnt, op;
void Read() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &Trap[i]);
    if (Trap[i]) tCells[++cnt] = i;
  }
  for (int i = 1; i <= M; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
}
void buildCoef() {
  for (int i = 1; i <= N; i++) {
    if (Trap[i])
      Coef[i][i] = 1.0;
    else {
      for (int j = 0; j < G[i].size(); j++) {
        int neighb = G[i][j];
        Coef[i][neighb] = Prob[i][neighb];
      }
      Coef[i][i] = -1.0;
    }
  }
}
void Gauss() {
  int i = 1, j = 1;
  while (i <= N && j <= N) {
    int k;
    for (k = i; k <= N && Coef[k][j] == 0; k++)
      ;
    if (k == N + 1) {
      ++j;
      continue;
    }
    if (i != k) {
      Op[++op] = {1, i, k, 0, 0};
      swap(Coef[i], Coef[k]);
    }
    for (k = i + 1; k <= N; k++) {
      if (Coef[k][j] != 0) {
        Op[++op] = {2, i, k, Coef[k][j] / Coef[i][j], 0};
        for (int p = j + 1; p <= N; p++)
          Coef[k][p] -= Coef[i][p] * (Coef[k][j] / Coef[i][j]);
        Coef[k][j] = 0;
      }
    }
    ++i;
    ++j;
  }
}
void buildProb() {
  for (int i = 1; i <= N; i++) {
    double prob = 1.0 / G[i].size();
    for (int j = 0; j < G[i].size(); j++)
      Prob[i][G[i][j]] += prob, tProb[i][G[i][j]] += prob;
  }
  for (int i = 1; i <= N; i++) {
    sort(G[i].begin(), G[i].end());
    G[i].erase(unique(G[i].begin(), G[i].end()), G[i].end());
  }
  buildCoef();
  Gauss();
  for (int i = 1; i <= N; i++) {
    if (!Trap[i]) continue;
    for (int j = 1; j <= N; j++) Res[j] = 0;
    Res[i] = 1;
    for (int j = 1; j <= N; j++) Ord[j] = j;
    for (int k = 1; k <= op; k++) {
      if (Op[k].type == 1) {
        swap(Res[Op[k].x], Res[Op[k].y]);
        swap(Ord[Op[k].x], Ord[Op[k].y]);
      } else
        Res[Op[k].y] -= Res[Op[k].x] * Op[k].mul;
    }
    for (int j = N; j >= 1; j--) {
      for (int k = N; k > j; k--) Res[j] -= Res[k] * Coef[j][k];
      Res[j] /= Coef[j][j];
      Prob[Ord[j]][i] = Res[j];
    }
    for (int j = 1; j <= N; j++) {
      int node = Ord[j];
      for (int k = 0; k < G[node].size(); k++) {
        int neighb = G[node][k];
        S[node][i] += tProb[node][neighb] * Prob[neighb][i];
      }
    }
  }
}
void royFloyd() {
  for (int k = 1; k <= N; k++) {
    if (Trap[k]) continue;
    for (int i = 1; i <= N; i++) {
      for (int j = 1; j <= N; j++) {
        Prob[i][j] += Prob[i][k] * Prob[k][j];
      }
    }
  }
}
void multiply(double A[][NMax], double B[][NMax], double C[][NMax]) {
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j <= cnt; j++) {
      C[i][j] = 0;
      for (int k = 1; k <= cnt; k++) C[i][j] += A[i][k] * B[k][j];
    }
  }
  for (int i = 1; i <= cnt; i++)
    for (int j = 1; j <= cnt; j++) A[i][j] = C[i][j];
}
void initSol() {
  for (int i = 1; i <= cnt; i++) Sol[i][i] = 1.0;
}
void power(int p) {
  initSol();
  while (p) {
    if (p % 2 == 1) multiply(Sol, P, Aux);
    p /= 2;
    multiply(P, P, Aux);
  }
}
void initializeP() {
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j <= cnt; j++) P[i][j] = S[tCells[j]][tCells[i]];
  }
}
void Solve() {
  power(K - 2);
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j <= cnt; j++) Aux[i][j] = 0;
  }
  Aux[1][cnt] = 1.0;
  multiply(Aux, Sol, P);
  double ans = 0.0;
  for (int i = 1; i <= cnt; i++) {
    ans += S[1][tCells[i]] * Aux[1][i];
  }
  printf("%.15f\n", ans);
}
int main() {
  Read();
  buildProb();
  initializeP();
  if (K == 2) {
    printf("%.15f\n", Prob[1][N]);
    return 0;
  }
  Solve();
  return 0;
}
