#include<bits/stdc++.h>
using namespace std;

inline int read()
{
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x;
}

#define maxn 610
double eps=1e-12;
double a[maxn][maxn],b[maxn][maxn],res[maxn][maxn];
int idx[maxn];
int deg[maxn];
int isf[maxn];
int n,m,k,tot,p;

void mult(double x[maxn][maxn],double y[maxn][maxn])
{
	static double c[maxn][maxn];
	for(int i=1;i<=p;i++)
		for(int j=1;j<=p;j++)
			c[i][j]=0;
	for(int k=1;k<=p;k++)
	{
		for(int i=1;i<=p;i++)
		{
			for(int j=1;j<=p;j++)
			{
				c[i][j]+=x[i][k]*y[k][j];
			}
		}
	}
	for(int i=1;i<=p;i++)
		for(int j=1;j<=p;j++)
			x[i][j]=c[i][j];
}

int main()
{
	n=read();m=read();k=read();
	tot=n;
	for(int i=1;i<=n;i++)
	{
		isf[i]=read();
		if (isf[i]) idx[i]=++tot;
	}
	for(int i=1;i<=m;i++)
	{
		int u,v;
		u=read();v=read();
		deg[u]++;deg[v]++;
		if (isf[v]) a[u][idx[v]]++;
		else a[u][v]++;
		if (isf[u]) a[v][idx[u]]++;
		else a[v][u]++;
	}
	p=tot-n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=tot;j++)
		{
			a[i][j]/=deg[i];
		}
		a[i][i]=-1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if (a[j][i])
			{
				for(int k=1;k<=tot;k++)
					swap(a[j][k],a[i][k]);
				break;
			}
		}
		for(int j=tot;j>=1;j--)
			a[i][j]/=a[i][i];
		for(int j=1;j<=n;j++)
		{
			if (j!=i && a[j][i])
			{
				for(int k=tot;k>=i;k--)
					a[j][k]-=a[j][i]*a[i][k];
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if (isf[i])
		{
			for(int j=n+1;j<=tot;j++)
			{
				b[idx[i]-n][j-n]=-a[i][j];
			}
		}
	}
	for(int i=1;i<=p;i++)
		res[i][i]=1;
	k-=2;
	while (k)
	{
		if (k&1) mult(res,b);
		mult(b,b);
		k>>=1;
	}
	double ans=0;
	for(int i=n+1;i<=n+p;i++)
		ans+=res[i-n][p]*(-a[1][i]);
	printf("%.8lf\n",ans);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <ctime>
#include <algorithm>
#define N 522
#define NN 123
template <typename T> inline void read(T &x) {
	x = 0; char c = getchar(); bool flag = false;
	while (!isdigit(c)) { if (c == '-')	flag = true; c = getchar(); }
	while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
	if (flag)	x = -x;
}
using namespace std;
const double eps = 1e-6;
inline double F(double num) {
	return num < 0 ? -num : num;
}
int n, m, K;
int hav[N];
int trp[NN], tcnt;
int e[N][N];
int d[N];
double h[N][N << 1];
struct matrix {
	double h[NN][NN];
	int n, m;
	matrix operator *(const matrix a) const {
		int nn = n, mm = m;
		matrix mx; mx.n = nn, mx.m = mm; memset(mx.h, 0, sizeof(mx.h));
		for (register int p = 1; p <= m; ++p) {
			for (register int i = 1; i <= nn; ++i) {
				for (register int j = 1; j <= mm; ++j) {
					//printf("h[%d][%d] = %.2lf\n", i, j, mx.h[i][j]);
					mx.h[i][j] += h[i][p] * a.h[p][j];
					//printf("i = %d, j = %d, p = %d\n", i, j, p);
				}
			}
		}
		//puts("end-----");
		return mx;
	}
}A, B;
inline void quickpow(int k) {
	while (k) {
		//printf("k = %d\n", k);
		//system("pause");
		if (k & 1)	A = A * B;
		B = B * B;
		k >>= 1;
	}
}
bool vis[N];

/*
inline void Print() {
	for (register int i = 1; i <= n; ++i) {
		for (register int j = 1; j <= n + n; ++j) {
			printf("%.2lf ", h[i][j]);
			if (j == n)	printf("| ");
		}
		puts("");
	}
	puts("---------");
}
*/

inline void work() {
	//for (register int i = 1; i <= n; ++i)	h[i][n + i] = 1;
	h[1][n + 1] = 1;
	for (register int i = 1; i <= n; ++i) {
		h[i][i] = 1;
		for (register int j = 1; j <= n; ++j) {
			if (j == i)	continue;
			if (!hav[j]) {
				h[i][j] = -1.0 * e[j][i] / d[j];
			} else {
				h[i][n + j] = 1.0 * e[j][i] / d[j];
			}
		}
	}
	//Print();
	for (register int i = 1; i <= n; ++i) {
		int id = -1;
		for (register int hang = i; hang <= n; ++hang) {
			if (F(h[hang][i]) > eps) {
				id = hang; break;
			}
		}
		//vis[id] = true;
		for (register int hang = 1; hang <= n; ++hang) {
			if (hang == id)	continue;
			double k = h[hang][i] / h[id][i];
			//printf("k = %.2lf\n", k);
			for (register int j = 1; j <= n + n; ++j) {
				h[hang][j] -= k * h[id][j];
			}
		}
		for (register int j = 1; j <= n + n; ++j)	swap(h[i][j], h[id][j]);
		for (register int j = i + 1; j <= n + n; ++j)	h[i][j] /= h[i][i];
		h[i][i] = 1;
		//Print();
	}

	/*
	for (register int i = 1; i <= n; ++i) {
		for (register int j = n + 1; j <= n + n; ++j) {
			h[i][j] /= h[i][i];
		}
		h[i][i] = 1;
	}
	*/

	A.n = 1, A.m = tcnt;
	B.n = B.m = tcnt;
	for (register int i = 1; i <= tcnt; ++i) {
		A.h[1][i] = h[trp[i]][n + 1] / h[trp[i]][trp[i]];
		//printf("i : %.4lf\n", A.h[1][i]);
	}
	//--K; --K;
	//++K;

	for (register int i = 1; i <= tcnt; ++i) {
		for (register int j = 1; j <= tcnt; ++j) {
			B.h[i][j] = h[trp[j]][n + trp[i]] / h[trp[j]][trp[j]];
			//printf("%.3lf ", B.h[i][j]);
			//printf("h[%d][%d] = %.3lf\n", trp[j], n + trp[i], h[trp[j]][n + trp[i]]);
		}
		//puts("");
	}

	//puts("P2");
	//printf("K = %d\n", K);
	//A = A * quickpow(B, K);
	quickpow(K - 2);
	printf("%.10lf\n", A.h[1][tcnt]);
}
int main() {
	read(n), read(m), read(K);
	for (register int i = 1; i <= n; ++i) {
		read(hav[i]);
		if (hav[i])	trp[++tcnt] = i;
	}
	for (register int i = 1; i <= m; ++i) {
		int u, v; read(u), read(v);
		//e[u][v] = e[v][u] = true;
		++e[u][v], ++e[v][u];
		++d[u], ++d[v];
	}
	//puts("P1");
	work();
	return 0;
}

/*
5 5 3
0 0 1 0 1
1 2
2 3
3 4
4 5
1 2
//0.25

3 2 2
0 1 1
1 2
2 3
//0

2 1 3
0 1
1 2
//1
*/


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <ctime>
#include <algorithm>
#define N 522
#define NN 123
template <typename T> inline void read(T &x) {
	x = 0; char c = getchar(); bool flag = false;
	while (!isdigit(c)) { if (c == '-')	flag = true; c = getchar(); }
	while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
	if (flag)	x = -x;
}
using namespace std;
const double eps = 1e-6;
inline double F(double num) {
	return num < 0 ? -num : num;
}
int n, m, K;
int hav[N];
int trp[NN], tcnt;
int e[N][N];
int d[N];
double h[N][N << 1];
struct matrix {
	double h[NN][NN];
	int n, m;
	matrix operator *(const matrix a) const {
		int nn = n, mm = m;
		matrix mx; mx.n = nn, mx.m = mm; memset(mx.h, 0, sizeof(mx.h));
		for (register int p = 1; p <= m; ++p) {
			for (register int i = 1; i <= nn; ++i) {
				for (register int j = 1; j <= mm; ++j) {
					mx.h[i][j] += h[i][p] * a.h[p][j];
				}
			}
		}
		return mx;
	}
}A, B;
inline void quickpow(int k) {
	while (k) {
		if (k & 1)	A = A * B;
		B = B * B;
		k >>= 1;
	}
}
bool vis[N];

inline void work() {
	h[1][n + 1] = 1;
	for (register int i = 1; i <= n; ++i) {
		h[i][i] = 1;
		for (register int j = 1; j <= n; ++j) {
			if (j == i)	continue;
			if (!hav[j]) {
				h[i][j] = -1.0 * e[j][i] / d[j];
			} else {
				h[i][n + j] = 1.0 * e[j][i] / d[j];
			}
		}
	}
	for (register int i = 1; i <= n; ++i) {
		int id = -1;
		for (register int hang = i; hang <= n; ++hang) {
			if (F(h[hang][i]) > eps) {
				id = hang; break;
			}
		}
		for (register int hang = 1; hang <= n; ++hang) {
			if (hang == id)	continue;
			double k = h[hang][i] / h[id][i];
			for (register int j = 1; j <= n + n; ++j) {
				h[hang][j] -= k * h[id][j];
			}
		}
		for (register int j = 1; j <= n + n; ++j)	swap(h[i][j], h[id][j]);
		for (register int j = i + 1; j <= n + n; ++j)	h[i][j] /= h[i][i];
		h[i][i] = 1;
	}

	A.n = 1, A.m = tcnt;
	B.n = B.m = tcnt;
	for (register int i = 1; i <= tcnt; ++i)
		A.h[1][i] = h[trp[i]][n + 1] / h[trp[i]][trp[i]];

	for (register int i = 1; i <= tcnt; ++i)
		for (register int j = 1; j <= tcnt; ++j)
			B.h[i][j] = h[trp[j]][n + trp[i]] / h[trp[j]][trp[j]];
	quickpow(K - 2);
	printf("%.10lf\n", A.h[1][tcnt]);
}
int main() {
	read(n), read(m), read(K);
	for (register int i = 1; i <= n; ++i) {
		read(hav[i]);
		if (hav[i])	trp[++tcnt] = i;
	}
	for (register int i = 1; i <= m; ++i) {
		int u, v; read(u), read(v);
		++e[u][v], ++e[v][u];
		++d[u], ++d[v];
	}
	work();
	return 0;
}

/*
5 5 3
0 0 1 0 1
1 2
2 3
3 4
4 5
1 2
//0.25

3 2 2
0 1 1
1 2
2 3
//0

2 1 3
0 1
1 2
//1
*/


#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#define R register int
using namespace std;
namespace Luitaryi {
inline int g() { R x=0,f=1;
  register char s; while(!isdigit(s=getchar())) f=s=='-'?-1:f;
  do x=x*10+(s^48); while(isdigit(s=getchar())); return x*f;
} const int N=603,M=100010;
const double eps=1e-8;
int n,m,k,tot;
int id[N],d[N],num[N];
double a[N][N],f[N][N],ans[N][N];
inline void mul(double a[N][N],double b[N][N]) {
  register double ret[N][N];
  memset(ret,0,sizeof ret);
  for(R i=1;i<=tot;++i) for(R k=1;k<=tot;++k) for(R j=1;j<=tot;++j)
    ret[i][j]+=a[i][k]*b[k][j];
  memcpy(a,ret,sizeof ret);
}
inline void qpow() {
  R b=k-2;
  for(;b;b>>=1,mul(f,f))
    if(b&1) mul(ans,f);
}
inline bool ck0(const double& x)
  {return fabs(x)<=eps;}
inline void gauss() {
  // for(int i=1;i<=n;++i,cout<<endl)
  //   for(int j=1;j<=n+tot+1;++j) printf("%3f ",a[i][j]); cout<<endl;
  for(R i=1;i<=n;++i) {
    R p=i;
    for(;ck0(a[p][i])&&p<=n;++p);
    if(p==n+1) continue;
    if(p!=i) swap(a[p],a[i]);
    register double t=a[i][i];
    for(R j=i;j<=n+tot+1;++j) a[i][j]/=t;
    for(R j=1;j<=n;++j) if(j!=i&&a[j][i]!=0) {
      register double t=a[j][i];
      for(R k=i;k<=n+tot+1;++k) a[j][k]-=a[i][k]*t;
    }
  }
  // for(int i=1;i<=n;++i,cout<<endl)
  //   for(int j=1;j<=n+tot+1;++j) printf("%3f ",a[i][j]); cout<<endl;
}
struct edge {int u,v;}e[M];
inline void main() {
  n=g(),m=g(),k=g();
  for(R i=1;i<=n;++i) {
    id[i]=g(); if(id[i])
      id[i]=++tot,num[tot]=i;
  }
  for(R i=1;i<=m;++i)
    ++d[e[i].u=g()],++d[e[i].v=g()];
  for(R i=1,u,v;i<=m;++i) {
    u=e[i].u,v=e[i].v;
    if(!id[u]) a[v][u]-=1.0/d[u];
    else a[v][id[u]+n]+=1.0/d[u];
    if(!id[v]) a[u][v]-=1.0/d[v];
    else a[u][id[v]+n]+=1.0/d[v];
  }
  a[1][tot+n+1]=1;
  for(R i=1;i<=n;++i) a[i][i]+=1;
  gauss();
  for(R i=1;i<=tot;++i) for(R j=1;j<=tot;++j) f[i][j]=a[num[j]][n+i];
  for(R i=1;i<=tot;++i) ans[1][i]=a[num[i]][n+tot+1];
  qpow();
  printf("%lf\n",ans[1][tot]);
}
} signed main() {Luitaryi::main(); return 0;}


#include <bits/stdc++.h>

using namespace std;

#define M 505
#define N 100005

int n, m, k, tot;
int id[M], pos[M], u[N], v[N], deg[M];
bool banned[M];

vector<int> G[M];

double A[M][M*2], C[M], X[M];

struct Matrix
{
	double a[M][M];

	Matrix() { memset(a, 0, sizeof(a)); }

	double *operator [](int x)
	{ return a[x]; }
} trans;

Matrix operator *(Matrix a, Matrix b)
{
	Matrix res;
	for (int i = 0; i <= tot; i++)
		for (int j = 0; j <= tot; j++)
			for (int k = 0; k <= tot; k++)
				res[i][j] += a[i][k] * b[k][j];
	return res;
}

inline Matrix quick_pow(Matrix x, int k)
{
	Matrix res;
	for (int i = 0; i <= tot; i++)
		res[i][i] = 1;
	while (k)
	{
		if (k & 1) res = res * x;
		x = x * x; k >>= 1;
	}
	return res;
}

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
	while (isdigit(ch)) { (x *= 10) += ch - '0'; ch = getchar(); }
	return x * f;
}

void Gauss()
{
	for (int i = 1; i <= n; i++)
	{
		int mx = i;
		for (int j = i + 1; j <= n; j++)
			if (abs(A[j][i]) > abs(A[mx][i]))
				mx = j;
		// if (abs(A[pos][i]) < EPS) exit(0);
		for (int j = 1; j <= i * 2; j++)
			swap(A[i][j], A[mx][j]);
		for (int j = i + 1; j <= n; j++)
		{
			if (abs(A[j][i]) < 1e-10) continue;
			double val = A[j][i] / A[i][i];
			for (int k = 1; k <= 2 * n; k++)
				A[j][k] -= A[i][k] * val;
		}
	}
	for (int i = n; i >= 1; i--)
	{
		double inv = 1.0 / A[i][i];
		for (int j = 1; j <= 2 * n; j++)
			A[i][j] *= inv;
		for (int j = i - 1; j >= 1; j--)
		{
			double val = A[j][i] / A[i][i];
			for (int k = 1; k <= 2 * n; k++)
				A[j][k] -= A[i][k] * val;
		}
	}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			swap(A[i][j], A[i][j+n]);
}

inline void solve()
{
	memset(X, 0, sizeof(X));
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			X[j] += C[i] * A[j][i];
}

int main()
{
	n = read(), m = read(), k = read();
	pos[++tot] = 1, id[1] = 1;
	for (int i = 1; i <= n; i++)
	{
		banned[i] = read();
		if (banned[i])
			pos[++tot] = i, id[i] = tot;
	}
	for (int i = 1; i <= m; i++)
	{
		u[i] = read(), v[i] = read();
		G[u[i]].push_back(v[i]);
		G[v[i]].push_back(u[i]);
		deg[u[i]]++, deg[v[i]]++;
	}

	for (int i = 1; i <= n; i++)
		A[i][i] = A[i][i+n] = 1;
	for (int i = 1; i <= m; i++)
	{
		if (!banned[u[i]])
			A[v[i]][u[i]] -= 1.0 / deg[u[i]];
		if (!banned[v[i]])
			A[u[i]][v[i]] -= 1.0 / deg[v[i]];
	}

	Gauss();

	for (int i = 1; i <= tot; i++)
	{
		memset(C, 0, sizeof(C));
		int p = pos[i];
		if (p == 1)
			C[1] = 1;
		else
		{
			C[p] = 1;
			for (int v : G[p])
				C[v] += 1.0 / deg[p];
		}
		solve();

		double sum = 1;
		for (int j = 1; j <= n; j++)
			if (banned[j] && j != p)
				trans[i][id[j]] = X[j], sum -= X[j];
		trans[i][i] = sum;
	}

	trans[tot][0] = 1;
	Matrix res;
	res[0][1] = 1;
	res = res * quick_pow(trans, k);
	printf("%.10lf\n", res[0][0]);

	return 0;
}


//CLOCKS_PER_SEC
using namespace std;
#include<bits/stdc++.h>
#define sqr(x) (x)*(x)
//#define sort stable_sort
#define ll long long
#define mk make_pair
#define pb push_back
#define in insert
#define mtr(x,y,z) mk(mk(x,y),z)
#define fi first
#define se second
#define lch(x) ((x)<<1)
#define rch(x) (((x)<<1)|1)
#define all(x) (x).begin(),(x).end()
#define titose CLOCKS_PER_SEC
#define fpi(x) freopen(x,"r",stdin);
#define fpo(x) freopen(x,"w",stdout);
#define fprio fpi("in.txt");fpo("out.txt");
#define fast ios_base::sync_with_stdio(false);
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(ll &x){ll 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(ll 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--;}}
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define sl set<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define msi map<string,int>
#define msl map<string,ll>
#define piii pair<int,pii >
#define piipi pair<pii,int>
#define plll pair<ll,pll >
#define pllpl pair<pll,ll>
#define pqi priority_queue<int>
#define pql priority_queue<ll>
#define npqi priority_queue<int,vector<int>,greater<int> >
#define npql priority_queue<ll,vector<ll>,greater<ll> >
#define forup(i,a,b) for ((i)=(a);(i)<=(b);(i)++)
#define fordo(i,a,b) for ((i)=(a);(i)>=(b);(i)--)
#define rep(i,x) forup ((i),1,(x))
#define repd(i,x) fordo ((i),(x),1)
#define itr iterator
#define fe(itcalc,c) for(__typeof((c).begin()) itcalc=(c).begin();itcalc!=(c).end();itcalc++)
#define NO {cout<<"NO";return 0;}
#define YES {cout<<"YES";return 0;}
#define y0 y000000000000000000000000000
#define y1 y111111111111111111111111111
#define j0 j000000000000000000000000000
#define j1 j111111111111111111111111111
#define cl0(a) memset((a),(0),(sizeof((a))))
#define clz(a) memset((a),(0x16),(sizeof((a))))
#define clf(a) memset((a),(-(0x16)),(sizeof((a))))
#define inf 0x3bbbbbbb
#define lnf 0x1bbbbbbbbbbbbbbbll
#define sqrt divi
#define p2(i) (1ll<<(i))
#define readi read
#define readll read
/*************************************************/
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;
	rep(i,cnt)rep(j,cnt){
		z.a[i][j]=0;
		rep(k,cnt){
			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);
	rep(i,n){
		scanf("%d",&typ[i]);
		if(typ[i]){
			ban[++cnt]=i;
			id[i]=cnt;
		}
	}
	rep(i,m){
		scanf("%d%d",&px[i],&py[i]);
		deg[px[i]]++;
		deg[py[i]]++;
	}
	rep(i,m){
		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;
	rep(i,n) f[i][i]=1;
	rep(i,n){
		int t=i;
		forup(j,i+1,n){
			if(abs(f[j][i])>abs(f[t][i])){
				t=j;
			}
		}
		rep(k,n+cnt+1){
			swap(f[i][k],f[t][k]);
		}
		double coef=f[i][i];
		rep(j,n+cnt+1) f[i][j]/=coef;
		rep(j,n)if(j!=i){
			double coef=f[j][i]/f[i][i];
			rep(k,n+cnt+1){
				f[j][k]-=f[i][k]*coef;
			}
		}
	}
	rep(i,cnt)rep(j,cnt){
		t.a[i][j]=f[ban[j]][i+n];
	}
	rep(i,cnt){
		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;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 505
#define eps (1e-8)
#define LL long long
using namespace std;

int N,M,K,B;
bool blk[MAXN];
int top = 0;
int n[MAXN], pos[MAXN];

vector<int> Adj[MAXN];
double b[MAXN][MAXN], divM[MAXN][MAXN], c[MAXN][MAXN];

void work(int j){

	double div;
	for(int i=1;i<=N;i++){
		for(int k=i+1;k<=N;k++){
	    	div = divM[i][k];
	    	c[k][j] -= div*c[i][j];
	    }
	}
}

void printB(){
	cout<<"%%%%%%% printB"<<endl;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N+1;j++) cout<<b[i][j]<<" ";
		cout<<endl;
	}
	cout<<endl;
}

void printC(){
	cout<<"%%%%%%% printC"<<endl;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++) cout<<c[i][j]<<" ";
		cout<<endl;
	}
	cout<<endl;
}

void Gauss();

struct mat{
    double a[105][105];

    mat(){
        memset(a, 0, sizeof(a));
    }

    mat operator * (const mat& m1) const{
    	mat ret;
    	for(int i=1;i<=B;i++){
    		for(int j=1;j<=B;j++){
    			for(int k=1;k<=B;k++){
    				ret.a[i][j] += a[i][k]*m1.a[k][j];
    			}
    		}
    	}
        return ret;
    }

    void print(){
    	cout<<"%%%%%%%%% printT"<<endl;
    	for(int i=1;i<=B;i++){
			for(int j=1;j<=B;j++) cout<<a[i][j]<<" ";
			cout<<endl;
		}
		cout<<endl;
    }
} t;

mat pow(mat x, LL n) {
    mat ret;
    for(int i=1;i<=B;i++){
    	ret.a[i][i] = 1;
    }

    while(n) {
        if(n & 1) ret = ret * x;
        x = x * x;
        n /= 2;
    }
    return ret;
}

double w[MAXN];

int main(){
	//ios::sync_with_stdio(0);

	scanf("%d%d%d", &N, &M, &K);
	for(int i=1;i<=N;i++){
		scanf("%d", &blk[i]);
		if(blk[i]){
			n[++top] = i;
			pos[i] = top;
		}
	}
	B = top;

	int u,v;
	for(int i=1;i<=M;i++){
		scanf("%d%d", &u, &v);

		Adj[u].push_back(v);
		Adj[v].push_back(u);
	}

	for(u=1;u<=N;u++){
		int m = Adj[u].size();
		b[u][u] = m;
		for(int k=0;k<m;k++){
			int v1 = Adj[u][k];
			if(blk[v1]) c[u][v1]++;
			else b[u][v1]--;
		}
	}
	Gauss();
	for(int j=1;j<=N;j++) work(j);
	//printC();

	for(v=1;v<=N;v++){
		for(int i=N;i>=1;i--) {
	        for(int k=i+1;k<=N;k++) c[i][v] -= c[k][v] * b[i][k];
	        c[i][v] /= b[i][i];
	    }

	    for(int i=1;i<=N;i++){
			if(!blk[i]) continue;
			t.a[pos[i]][pos[v]] = c[i][v];
		}

		w[pos[v]] = c[1][v];
	}

//	t.print();
	t = pow(t, K-2);
//	t.print();

//	for(int j=1;j<=B;j++) cout<<w[j]<<" ";
//	cout<<endl;

	double ans = 0;
	for(int j=1;j<B;j++){
		for(int i=1;i<=B;i++){
			ans += w[i]*t.a[i][j];
		}
	}
	printf("%.6lf\n", 1-ans);

 	return 0;
}

void Gauss(){
    for(int i=1;i<=N;i++){
//        int p = i;
//        for(int k=i+1;k<=N;k++){
//            if(fabs(b[k][i]) > fabs(b[p][i])) p = k;
//        }
//
//        if(p != i){
//            for(int j=1;j<=N+1;j++) swap(b[i][j], b[p][j]);
//        }
//
//        if(fabs(b[i][i])<=eps) return 0;

        double div;
        for(int k=i+1;k<=N;k++){
        	div = b[k][i]/b[i][i];
            for(int j=i;j<=N+1;j++){
            	b[k][j] -= div*b[i][j];
            	if(j==N+1) divM[i][k] = div;
			}
        }
    }

//    for(int i=N;i>=1;i--) {
//        for(int k=i+1;k<=N;k++) b[i][N+1] -= b[k][N+1] * b[i][k];
//        b[i][N+1] /= b[i][i];
//    }
//    //
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 505
#define eps (1e-8)
#define LL long long
using namespace std;

int N,M,K,B;
bool blk[MAXN];
int top = 0;
int n[MAXN], pos[MAXN];

vector<int> Adj[MAXN];
double b[MAXN][2*MAXN], c[MAXN][MAXN];

void printB(){
	cout<<"%%%%%%% printB"<<endl;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=2*N;j++) cout<<b[i][j]<<" ";
		cout<<endl;
	}
	cout<<endl;
}

void printC(){
	cout<<"%%%%%%% printC"<<endl;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++) cout<<c[i][j]<<" ";
		cout<<endl;
	}
	cout<<endl;
}

bool Gauss();

struct mat{
    double a[105][105];

    mat(){
        memset(a, 0, sizeof(a));
    }

    mat operator * (const mat& m1) const{
    	mat ret;
    	for(int i=1;i<=B;i++){
    		for(int j=1;j<=B;j++){
    			for(int k=1;k<=B;k++){
    				ret.a[i][j] += a[i][k]*m1.a[k][j];
    			}
    		}
    	}
        return ret;
    }

    void print(){
    	cout<<"%%%%%%%%% printT"<<endl;
    	for(int i=1;i<=B;i++){
			for(int j=1;j<=B;j++) cout<<a[i][j]<<" ";
			cout<<endl;
		}
		cout<<endl;
    }
} t;

mat pow(mat x, LL n) {
    mat ret;
    for(int i=1;i<=B;i++){
    	ret.a[i][i] = 1;
    }

    while(n) {
        if(n & 1) ret = ret * x;
        x = x * x;
        n /= 2;
    }
    return ret;
}

double w[MAXN];

int main(){
	scanf("%d%d%d", &N, &M, &K);
	for(int i=1;i<=N;i++){
		scanf("%d", &blk[i]);
		if(blk[i]){
			n[++top] = i;
			pos[i] = top;
		}
	}
	B = top;

	int u,v;
	for(int i=1;i<=M;i++){
		scanf("%d%d", &u, &v);

		Adj[u].push_back(v);
		Adj[v].push_back(u);
	}

	for(u=1;u<=N;u++){
		int m = Adj[u].size();
		b[u][u] = m;
		for(int k=0;k<m;k++){
			int v1 = Adj[u][k];
			if(blk[v1]) c[u][v1]++;
			else b[u][v1]--;
		}
		b[u][u+N] = 1;
	}

	Gauss();
	//printC();
	//printB();
	for(int k=1;k<=N;k++){
		if(!blk[k]) continue;
		int v = pos[k];
		for(int i=1;i<=B;i++){
			int u = n[i];
			for(int j=1;j<=N;j++){
				t.a[i][v] += b[u][N+j]*c[j][k];
			}
		}

		for(int j=1;j<=N;j++){
			w[v] += b[1][N+j]*c[j][k];
		}
	}

	t = pow(t, K-2);

	double ans = 0;
	for(int i=1;i<=B;i++){
		ans += w[i]*t.a[i][B];
	}
	printf("%.6lf\n", ans);
 	return 0;
}

bool Gauss(){//matrix inverse
    for(int i=1;i<=N;i++){
        double div;
        for(int k=i+1;k<=N;k++){
        	div = b[k][i] / b[i][i];
            for(int j=i;j<=2*N;j++){
            	b[k][j] -= div*b[i][j];
			}
        }
    }

	//printB();
    for(int i=N;i>=1;i--) {
        for(int k=i+1;k<=N;k++){
        	for(int j=2*N;j>=i;j--){
        		b[i][j] -= b[k][j]*b[i][k];
			}
		}
		for(int j=2*N;j>=i;j--) b[i][j] /= b[i][i];
    }
    //printB();
    return 1;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 505
#define eps (1e-8)
#define LL long long
using namespace std;

int N,M,K,B;
bool blk[MAXN];
int top = 0;
int n[MAXN], pos[MAXN];

vector<int> Adj[MAXN];
double b[MAXN][2*MAXN], c[MAXN][MAXN];
bool Gauss();

struct mat{
    double a[105][105];
    mat(){
        memset(a, 0, sizeof(a));
    }

    mat operator * (const mat& m1) const{
    	mat ret;
    	for(int i=1;i<=B;i++){
    		for(int j=1;j<=B;j++){
    			for(int k=1;k<=B;k++){
    				ret.a[i][j] += a[i][k]*m1.a[k][j];
    			}
    		}
    	}
        return ret;
    }

    mat pow(LL n) {
	    mat ret;
	    mat x = *this;
	    for(int i=1;i<=B;i++) ret.a[i][i] = 1;

	    while(n) {
	        if(n & 1) ret = ret * x;
	        x = x * x;
	        n /= 2;
	    }
	    return ret;
	}
} t;

double w[MAXN];

int main(){
	scanf("%d%d%d", &N, &M, &K);
	for(int i=1;i<=N;i++){
		scanf("%d", &blk[i]);
		if(blk[i]){
			n[++top] = i;
			pos[i] = top;
		}
	}
	B = top;

	int u,v;
	for(int i=1;i<=M;i++){
		scanf("%d%d", &u, &v);

		Adj[u].push_back(v);
		Adj[v].push_back(u);
	}

	for(u=1;u<=N;u++){
		int m = Adj[u].size();
		b[u][u] = m;
		for(int k=0;k<m;k++){
			int v1 = Adj[u][k];
			if(blk[v1]) c[u][v1]++;
			else b[u][v1]--;
		}
		b[u][u+N] = 1;
	}

	Gauss();
	for(int k=1;k<=N;k++){
		if(!blk[k]) continue;
		int v = pos[k];
		for(int i=1;i<=B;i++){
			int u = n[i];
			for(int j=1;j<=N;j++){
				t.a[i][v] += b[u][N+j]*c[j][k];
			}
		}

		for(int j=1;j<=N;j++){
			w[v] += b[1][N+j]*c[j][k];
		}
	}

	t = t.pow(K-2);

	double ans = 0;
	for(int i=1;i<=B;i++){
		ans += w[i]*t.a[i][B];
	}
	printf("%.6lf\n", ans);
 	return 0;
}

bool Gauss(){//matrix inverse
    for(int i=1;i<=N;i++){
        double div;
        for(int k=i+1;k<=N;k++){
        	div = b[k][i] / b[i][i];
            for(int j=i;j<=2*N;j++){
            	b[k][j] -= div*b[i][j];
			}
        }
    }

    for(int i=N;i>=1;i--) {
        for(int k=i+1;k<=N;k++){
        	for(int j=2*N;j>=i;j--){
        		b[i][j] -= b[k][j]*b[i][k];
			}
		}
		for(int j=2*N;j>=i;j--) b[i][j] /= b[i][i];
    }
    return 1;
}


// Jun 18 2015, minsu( github : https://github.com/minsuu/ )
#include <bits/stdc++.h>
typedef long double llf;
using namespace std;
const int MAXN=555;
llf imat[MAXN][MAXN], column[MAXN], nmat[MAXN][MAXN];
void takeInverse(int N, llf (&mat)[MAXN][MAXN]){
	int i,j,k,l; llf t, pv;
	for(i=0;i<N;i++) for(j=0;j<N;j++) imat[i][j]=(i==j);
	for(j=0;j<N;j++){
		l = j;
		for(i=j+1;i<N;i++)
			if(fabs(mat[i][j])>fabs(mat[l][j]))
				l = i;
		pv = mat[l][j];
		for(k=0;k<N;k++){
			swap(mat[j][k],mat[l][k]), swap(imat[j][k], imat[l][k]);
			mat[j][k] /= pv; imat[j][k] /= pv;
		}
		for(i=0;i<N;i++){
			if( i == j ) continue;
			t = mat[i][j] / mat[j][j];
			for(k=0;k<N;k++){
				 mat[i][k] -=  mat[j][k] * t;
				imat[i][k] -= imat[j][k] * t;
			}
		}
	}
	for(i=0;i<N;i++) for(j=0;j<N;j++) swap(mat[i][j], imat[i][j]);
}

int N,M,K, a,b, cn, adj[MAXN][MAXN], critical[MAXN], criticals[MAXN], degree[MAXN];
llf mat[MAXN][MAXN], tmp[MAXN][MAXN], R[MAXN][MAXN];
int main(){
	scanf("%d%d%d",&N,&M,&K); K-=2;
	for(int i=0;i<N;i++){
		scanf("%d",&critical[i]);
		if(critical[i]) criticals[cn++] = i;
	}
	for(int i=0;i<M;i++){
		scanf("%d%d",&a,&b); a--; b--;
		adj[a][b]++; adj[b][a]++; degree[a]++; degree[b]++;
	}
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++){
			if( i == j ) mat[i][j] = 1;
			else mat[i][j] = critical[i] ? 0.0 : -1.0 * adj[i][j] / degree[i] ;
		}
	takeInverse(N, mat);
	for(int i=0; i<cn; i++){
		for(int j=0; j<cn; j++){
			llf p = 0.0;
			for(int k=0;k<N;k++) p += 1.0 * adj[criticals[i]][k] / degree[criticals[i]] * mat[k][criticals[j]];
			nmat[i][j] = p;
		}
	}
	for(int i=0; i<cn; i++) R[i][i]=1;
	while( K ){
		if( K & 1 ){
			for(int i=0; i<cn; i++)
				for(int j=0; j<cn; j++){
					tmp[i][j] = 0;
					for(int k=0; k<cn; k++)
						tmp[i][j] += R[i][k] * nmat[k][j];
				}
			memcpy( R, tmp, sizeof tmp );
		}
		for(int i=0; i<cn; i++)
			for(int j=0; j<cn; j++){
				tmp[i][j] = 0;
				for(int k=0; k<cn; k++)
					tmp[i][j] += nmat[i][k] * nmat[k][j];
			}
		memcpy( nmat, tmp, sizeof tmp );
		K >>= 1;
	}
	llf ans = 0;
	for(int i=0; i<cn; i++){
		ans += mat[0][criticals[i]] * R[i][cn-1];
	}
	cout<<setprecision(10)<<fixed<<ans;
	return 0;
}


// Jun 18 2015, minsu( github : https://github.com/minsuu/ )
#include <bits/stdc++.h>
typedef long double llf;
using namespace std;
const int MAXN=555;
llf imat[MAXN][MAXN], column[MAXN], nmat[MAXN][MAXN];
void takeInverse(int N, llf (&mat)[MAXN][MAXN]){
	int i,j,k,l; llf t, pv;
	for(i=0;i<N;i++) for(j=0;j<N;j++) imat[i][j]=(i==j);
	for(j=0;j<N;j++){
		l = j;
		for(i=j+1;i<N;i++)
			if(fabs(mat[i][j])>fabs(mat[l][j]))
				l = i;
		pv = mat[l][j];
		for(k=0;k<N;k++){
			swap(mat[j][k],mat[l][k]), swap(imat[j][k], imat[l][k]);
			mat[j][k] /= pv; imat[j][k] /= pv;
		}
		for(i=0;i<N;i++){
			if( i == j ) continue;
			t = mat[i][j] / mat[j][j];
			for(k=0;k<N;k++){
				 mat[i][k] -=  mat[j][k] * t;
				imat[i][k] -= imat[j][k] * t;
			}
		}
	}
	for(i=0;i<N;i++) for(j=0;j<N;j++) swap(mat[i][j], imat[i][j]);
}

int N,M,K, a,b, cn, adj[MAXN][MAXN], critical[MAXN], criticals[MAXN], degree[MAXN];
llf mat[MAXN][MAXN], tmp[MAXN][MAXN], R[MAXN][MAXN];
int main(){
	scanf("%d%d%d",&N,&M,&K); K-=2;
	for(int i=0;i<N;i++){
		scanf("%d",&critical[i]);
		if(critical[i]) criticals[cn++] = i;
	}
	for(int i=0;i<M;i++){
		scanf("%d%d",&a,&b); a--; b--;
		adj[a][b]++; adj[b][a]++; degree[a]++; degree[b]++;
	}
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++){
			if( i == j ) mat[i][j] = 1;
			else mat[i][j] = critical[i] ? 0.0 : -1.0 * adj[i][j] / degree[i] ;
		}
	takeInverse(N, mat);
	for(int i=0; i<cn; i++){
		for(int j=0; j<cn; j++){
			llf p = 0.0;
			for(int k=0;k<N;k++) p += 1.0 * adj[criticals[i]][k] / degree[criticals[i]] * mat[k][criticals[j]];
			nmat[i][j] = p;
		}
	}
	for(int i=0; i<cn; i++) R[i][i]=1;
	while( K ){
		if( K & 1 ){
			for(int i=0; i<cn; i++)
				for(int j=0; j<cn; j++){
					tmp[i][j] = 0;
					for(int k=0; k<cn; k++)
						tmp[i][j] += R[i][k] * nmat[k][j];
				}
			memcpy( R, tmp, sizeof tmp );
		}
		for(int i=0; i<cn; i++)
			for(int j=0; j<cn; j++){
				tmp[i][j] = 0;
				for(int k=0; k<cn; k++)
					tmp[i][j] += nmat[i][k] * nmat[k][j];
			}
		memcpy( nmat, tmp, sizeof tmp );
		K >>= 1;
	}
	llf ans = 0;
	for(int i=0; i<cn; i++){
		ans += mat[0][criticals[i]] * R[i][cn-1];
	}
	printf("%.10Lf",ans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>

#define pb push_back
#define MAX_N 510
#define MAX_A 110

struct Matrix{
	int n, m;
	double a[MAX_A][MAX_A];
	Matrix(int n, int m) : n(n), m(m){
		memset(a, 0, sizeof(a));
	}
	double *operator [](int x){
		return a[x];
	}
};

Matrix operator *(Matrix x, Matrix y){
	Matrix z(x.n, y.m);
	for(int i = 1; i <= x.n; i++)
		for(int k = 1; k <= x.m; k++)
			for(int j = 1; j <= y.m; j++)
				z[i][j] += x[i][k] * y[k][j];
	return z;
}

Matrix ksm(Matrix x, int y){
	Matrix z(x.n, x.n);
	for(int i = 1; i <= x.n; i++)
		z[i][i] = 1;
	for(; y; y >>= 1, x = x * x)
		if(y & 1) z = x * z;
	return z;
}

int n, m, K, deg[MAX_N], a[MAX_A], typ[MAX_N];
double A[MAX_N][MAX_N + MAX_A];
std::vector<int> to[MAX_N];

int main(){
	scanf("%d%d%d", &n, &m, &K);
	for(int i = 1; i <= n; i++){
		scanf("%d", &typ[i]);
		if(typ[i]) a[++a[0]] = i;
	}
	for(int i = 1, x, y; i <= m; i++){
		scanf("%d%d", &x, &y);
		deg[x]++, deg[y]++;
		to[x].pb(y), to[y].pb(x);
	}
	for(int i = 1; i <= n; i++){
		if(!typ[i]){
			for(auto j: to[i])
				A[i][j] += 1.0 / deg[i];
			A[i][i] = -1;
		}else{
			A[i][i] = 1;
			for(int j = 1; j <= a[0]; j++) if(a[j] == i)
				A[i][n+j] = 1;
		}
	}
	int lim = a[0] + n;
	double t;
	for(int i = 1; i <= n; i++){
		t = A[i][i];
		for(int j = 1; j <= lim; j++)
			A[i][j] /= t;
		for(int j = i + 1; j <= n; j++){
			t = A[j][i] / A[i][i];
			for(int k = 1; k <= lim; k++)
				A[j][k] -= A[i][k] * t;
		}
	}
	for(int i = n; i; i--)
		for(int j = i - 1; j; j--)
			for(int k = n + 1; k <= lim; k++)
				A[j][k] -= A[j][i] * A[i][k];
	Matrix x(1, a[0]), y(a[0], a[0]);
	for(int i = 1; i <= a[0]; i++)
		x[1][i] = A[1][n + i];
	for(int i = 1; i <= a[0]; i++)
		for(int j = 1; j <= a[0]; j++){
			for(auto k: to[a[i]])
				y[i][j] += A[k][n + j];
			y[i][j] /= deg[a[i]];
		}
	x = x * ksm(y, K - 2);
	printf("%.6lf\n", x[1][a[0]]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int N=610;
const int M=100010;
int n,m,t,cnt,id[N],p[N],ind[N];
double a[N][N];
struct Node{
	int x,y;
}e[M];

struct Matrix{
	int r,c;double a[110][110];
	Matrix(int _r=0,int _c=0)
		{r=_r,c=_c,memset(a,0,sizeof(a));}
	inline Matrix operator *(const Matrix& that)
	{
		Matrix t=*this,res(t.r,that.c);
		for(int i=1;i<=res.r;i++)
			for(int k=1;k<=t.c;k++)
				for(int j=1;j<=res.c;j++)
					res.a[i][j]+=t.a[i][k]*that.a[k][j];
		return res;
	}
	inline Matrix operator ^(int y)
	{
		Matrix t=*this,res(t.r,t.r);
		for(int i=1;i<=res.r;i++)
			res.a[i][i]=1;
		for(;y;y>>=1,t=t*t)
			if(y&1)res=res*t;
		return res;
	}

	inline void opt()
	{
		for(int i=1;i<=r;i++)
		{
			for(int j=1;j<=c;j++)
				cout<<a[i][j]<<" ";
			cout<<endl;
		}
	}
}A,B;

inline void gauss()
{
	for(int i=1;i<=n;i++)
	{
		int r=i;
		for(int j=i+1;j<=n;j++)
			if(fabs(a[j][i])>fabs(a[r][i]))r=j;
		if(r!=i)swap(a[i],a[r]);
		double tem=a[i][i];
		for(int j=i;j<=n+cnt+1;j++)a[i][j]/=tem;
		for(int j=1;j<=n;j++)if(j!=i)
		{
			tem=a[j][i];
			for(int k=i;k<=n+cnt+1;k++)
				a[j][k]-=a[i][k]*tem;
		}
	}
}

int main()
{
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&id[i]);
		if(id[i])id[i]=++cnt,p[cnt]=i;
	}
	for(int i=1;i<=m;i++)
		scanf("%d%d",&e[i].x,&e[i].y),
		ind[e[i].x]++,ind[e[i].y]++;
	for(int i=1,x,y;i<=m;i++)
	{
		x=e[i].x,y=e[i].y;
		if(!id[x])a[y][x]-=1.0/ind[x];
		else a[y][id[x]+n]+=1.0/ind[x];
		if(!id[y])a[x][y]-=1.0/ind[y];
		else a[x][id[y]+n]+=1.0/ind[y];
	}
	a[1][n+cnt+1]=1;
	for(int i=1;i<=n;i++)a[i][i]=1;

//	for(int i=1;i<=n;i++)
//    {
//    	for(int j=1;j<=n+cnt+1;j++)
//    		cout<<a[i][j]<<" ";
//    	cout<<endl;
//	}
	gauss();
	A.r=A.c=B.r=B.c=cnt;
	for(int i=1;i<=cnt;i++)
		for(int j=1;j<=cnt;j++)B.a[i][j]=a[p[j]][i+n];
//	B.opt();
	for(int i=1;i<=cnt;i++)A.a[1][i]=a[p[i]][n+cnt+1];
	B=B^(t-2);
	A=A*B;
	printf("%.10lf\n",A.a[1][cnt]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int N=610;
const int M=100010;
int n,m,t,cnt,id[N],p[N],ind[N];
double a[N][N];
struct Node{
	int x,y;
}e[M];

struct Matrix{
	int r,c;double a[110][110];
	Matrix(int _r=0,int _c=0)
		{r=_r,c=_c,memset(a,0,sizeof(a));}
	inline Matrix operator *(const Matrix& that)
	{
		Matrix t=*this,res(t.r,that.c);
		for(int i=1;i<=res.r;i++)
			for(int k=1;k<=t.c;k++)
				for(int j=1;j<=res.c;j++)
					res.a[i][j]+=t.a[i][k]*that.a[k][j];
		return res;
	}
	inline Matrix operator ^(int y)
	{
		Matrix t=*this,res(t.r,t.r);
		for(int i=1;i<=res.r;i++)
			res.a[i][i]=1;
		for(;y;y>>=1,t=t*t)
			if(y&1)res=res*t;
		return res;
	}

	inline void opt()
	{
		for(int i=1;i<=r;i++)
		{
			for(int j=1;j<=c;j++)
				cout<<a[i][j]<<" ";
			cout<<endl;
		}
	}
}A,B;

inline void gauss()
{
	for(int i=1;i<=n;i++)
	{
		int r=i;
		for(int j=i+1;j<=n;j++)
			if(fabs(a[j][i])>fabs(a[r][i]))r=j;
		if(r!=i)swap(a[i],a[r]);
		double tem=a[i][i];
		for(int j=i;j<=n+cnt+1;j++)a[i][j]/=tem;
		for(int j=1;j<=n;j++)if(j!=i)
		{
			tem=a[j][i];
			for(int k=i;k<=n+cnt+1;k++)
				a[j][k]-=a[i][k]*tem;
		}
	}
}

int main()
{
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&id[i]);
		if(id[i])id[i]=++cnt,p[cnt]=i;
	}
	for(int i=1;i<=m;i++)
		scanf("%d%d",&e[i].x,&e[i].y),
		ind[e[i].x]++,ind[e[i].y]++;
	for(int i=1,x,y;i<=m;i++)
	{
		x=e[i].x,y=e[i].y;
		if(!id[x])a[y][x]-=1.0/ind[x];
		else a[y][id[x]+n]+=1.0/ind[x];
		if(!id[y])a[x][y]-=1.0/ind[y];
		else a[x][id[y]+n]+=1.0/ind[y];
	}
	a[1][n+cnt+1]=1;
	for(int i=1;i<=n;i++)a[i][i]+=1;

//	for(int i=1;i<=n;i++)
//    {
//    	for(int j=1;j<=n+cnt+1;j++)
//    		cout<<a[i][j]<<" ";
//    	cout<<endl;
//	}
	gauss();
	A.r=A.c=B.r=B.c=cnt;
	for(int i=1;i<=cnt;i++)
		for(int j=1;j<=cnt;j++)B.a[i][j]=a[p[j]][i+n];
//	B.opt();
	for(int i=1;i<=cnt;i++)A.a[1][i]=a[p[i]][n+cnt+1];
	B=B^(t-2);
	A=A*B;
	printf("%.10lf\n",A.a[1][cnt]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int N=610;
const int M=100010;
int n,m,t,cnt,id[N],p[N],ind[N];
double a[N][N];
struct Node{
	int x,y;
}e[M];

struct Matrix{
	int r,c;double a[110][110];
	Matrix(int _r=0,int _c=0)
		{r=_r,c=_c,memset(a,0,sizeof(a));}
	inline Matrix operator *(const Matrix& that)
	{
		Matrix t=*this,res(t.r,that.c);
		for(int i=1;i<=res.r;i++)
			for(int k=1;k<=t.c;k++)
				for(int j=1;j<=res.c;j++)
					res.a[i][j]+=t.a[i][k]*that.a[k][j];
		return res;
	}
	inline Matrix operator ^(int y)
	{
		Matrix t=*this,res(t.r,t.r);
		for(int i=1;i<=res.r;i++)
			res.a[i][i]=1;
		for(;y;y>>=1,t=t*t)
			if(y&1)res=res*t;
		return res;
	}

	inline void opt()
	{
		for(int i=1;i<=r;i++)
		{
			for(int j=1;j<=c;j++)
				cout<<a[i][j]<<" ";
			cout<<endl;
		}
	}
}A,B;

inline void gauss()
{
	for(int i=1;i<=n;i++)
	{
		int r=i;
		for(int j=i+1;j<=n;j++)
			if(fabs(a[j][i])>fabs(a[r][i]))r=j;
		if(r!=i)swap(a[i],a[r]);
		double tem=a[i][i];
		for(int j=i;j<=n+cnt+1;j++)a[i][j]/=tem;
		for(int j=i+1;j<=n;j++)if(j!=i)
		{
			tem=a[j][i];
			for(int k=i;k<=n+cnt+1;k++)
				a[j][k]-=a[i][k]*tem;
		}
	}
}

int main()
{
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&id[i]);
		if(id[i])id[i]=++cnt,p[cnt]=i;
	}
	for(int i=1;i<=m;i++)
		scanf("%d%d",&e[i].x,&e[i].y),
		ind[e[i].x]++,ind[e[i].y]++;
	for(int i=1,x,y;i<=m;i++)
	{
		x=e[i].x,y=e[i].y;
		if(!id[x])a[y][x]-=1.0/ind[x];
		else a[y][id[x]+n]+=1.0/ind[x];
		if(!id[y])a[x][y]-=1.0/ind[y];
		else a[x][id[y]+n]+=1.0/ind[y];
	}
	a[1][n+cnt+1]=1;
	for(int i=1;i<=n;i++)a[i][i]=1;

//	for(int i=1;i<=n;i++)
//    {
//    	for(int j=1;j<=n+cnt+1;j++)
//    		cout<<a[i][j]<<" ";
//    	cout<<endl;
//	}
	gauss();
	A.r=A.c=B.r=B.c=cnt;
	for(int i=1;i<=cnt;i++)
		for(int j=1;j<=cnt;j++)B.a[i][j]=a[p[j]][i+n];
//	B.opt();
	for(int i=1;i<=cnt;i++)A.a[1][i]=a[p[i]][n+cnt+1];
	B=B^(t-2);
	A=A*B;
	printf("%.10lf\n",A.a[1][cnt]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int N=610;
const int M=100010;
int n,m,t,cnt,id[N],p[N],ind[N];
double a[N][N];
struct Node{
	int x,y;
}e[M];

struct Matrix{
	int r,c;double a[110][110];
	Matrix(int _r=0,int _c=0)
		{r=_r,c=_c,memset(a,0,sizeof(a));}
	inline Matrix operator *(const Matrix& that)
	{
		Matrix t=*this,res(t.r,that.c);
		for(int i=1;i<=res.r;i++)
			for(int k=1;k<=t.c;k++)
				for(int j=1;j<=res.c;j++)
					res.a[i][j]+=t.a[i][k]*that.a[k][j];
		return res;
	}
	inline Matrix operator ^(int y)
	{
		Matrix t=*this,res(t.r,t.r);
		for(int i=1;i<=res.r;i++)
			res.a[i][i]=1;
		for(;y;y>>=1,t=t*t)
			if(y&1)res=res*t;
		return res;
	}

	inline void opt()
	{
		for(int i=1;i<=r;i++)
		{
			for(int j=1;j<=c;j++)
				cout<<a[i][j]<<" ";
			cout<<endl;
		}
	}
}A,B;

inline void gauss()
{
	for(int i=1;i<=n;i++)
	{
		int r=i;
		for(int j=i+1;j<=n;j++)
			if(fabs(a[j][i])>fabs(a[r][i]))r=j;
		if(r!=i)swap(a[i],a[r]);
		double tem=a[i][i];
		for(int j=i;j<=n+cnt+1;j++)a[i][j]/=tem;
		for(int j=1;j<=n;j++)if(j!=i)
		{
			tem=a[j][i];
			for(int k=1;k<=n+cnt+1;k++)
				a[j][k]-=a[i][k]*tem;
		}
	}
}

int main()
{
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&id[i]);
		if(id[i])id[i]=++cnt,p[cnt]=i;
	}
	for(int i=1;i<=m;i++)
		scanf("%d%d",&e[i].x,&e[i].y),
		ind[e[i].x]++,ind[e[i].y]++;
	for(int i=1,x,y;i<=m;i++)
	{
		x=e[i].x,y=e[i].y;
		if(!id[x])a[y][x]-=1.0/ind[x];
		else a[y][id[x]+n]+=1.0/ind[x];
		if(!id[y])a[x][y]-=1.0/ind[y];
		else a[x][id[y]+n]+=1.0/ind[y];
	}
	a[1][n+cnt+1]=1;
	for(int i=1;i<=n;i++)a[i][i]+=1;

//	for(int i=1;i<=n;i++)
//    {
//    	for(int j=1;j<=n+cnt+1;j++)
//    		cout<<a[i][j]<<" ";
//    	cout<<endl;
//	}
	gauss();
	A.r=A.c=B.r=B.c=cnt;
	for(int i=1;i<=cnt;i++)
		for(int j=1;j<=cnt;j++)B.a[i][j]=a[p[j]][i+n];
//	B.opt();
	for(int i=1;i<=cnt;i++)A.a[1][i]=a[p[i]][n+cnt+1];
	B=B^(t-2);
	A=A*B;
	printf("%.10lf\n",A.a[1][cnt]);
	return 0;
}


/************************************************
 * Au: Hany01
 * Date: Mar 22nd, 2019
 * Prob: cf446d DZY loves games
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 WoXiHuanNiA

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template <typename T> inline T read() {
	register T _, __; register char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ * 10) + (c_ ^ 48);
    return _ * __;
}
//EOT

const int MAXN = 505, MAXT = 105;
const double EPS = 1e-8;

int dcmp(double x) {
	if (fabs(x) < EPS) return 0;
	return x < 0 ? -1 : 1;
}

void printMatrix(double a[][MAXN], int n) {
	For(i, 1, n) {
		For(j, 1, n) printf("%g ", a[i][j]);
		putchar('\n');
	}
	putchar('\n');
}

void getInvMatrix(double a[][MAXN], double b[][MAXN], int n) {
	static double A[MAXN][MAXN], B[MAXN][MAXN];

	Set(B, 0);
	For(i, 1, n) {
		For(j, 1, n)
			A[i][j] = a[i][j];
		B[i][i] = 1;
	}

	For(i, 1, n) {
		if (!dcmp(A[i][i])) {
			int flag = 0;
			For(j, i + 1, n)
				if (dcmp(A[j][i])) {
					swap(A[i], A[j]);
					swap(B[i], B[j]);
					flag = 1;
					break;
				}
			assert(flag);
		}

		For(j, i + 1, n)
			if (dcmp(A[j][i])) {
				double d = A[j][i] / A[i][i];
				For(k, i, n)
					A[j][k] = A[j][k] - A[i][k] * d;
				For(k, 1, n)
					B[j][k] = B[j][k] - B[i][k] * d;
				//assert(!dcmp(A[j][i]));
			}
	}

	Fordown(i, n, 1) {
		double t = A[i][i];
		For(j, 1, n) B[i][j] = B[i][j] / t;
		A[i][i] = 1;
		For(j, 1, i - 1) {
			double t = A[j][i];
			For(k, 1, n)
				B[j][k] = B[j][k] - B[i][k] * t;
			A[j][i] = 0;
		}
	}

	For(i, 1, n)
		For(j, 1, n)
			b[i][j] = B[i][j];
}

void Mult(double A[][MAXN], double *B, double *C, int n) {
	static double D[MAXN];
	For(i, 1, n) {
		D[i] = 0;
		For(j, 1, n)
			D[i] += A[i][j] * B[j];
	}
	For(i, 1, n) C[i] = D[i];
}

void Mult(double A[][MAXN], double B[][MAXN], double C[][MAXN], int n) {
	static double D[MAXN][MAXN];
	For(i, 1, n) {
		For(j, 1, n) {
			D[i][j] = 0;
			For(k, 1, n)
				D[i][j] += A[i][k] * B[k][j];
		}
	}
	For(i, 1, n) For(j, 1, n)
		C[i][j] = D[i][j];
}

void FPM(double A[][MAXN], int k, double B[][MAXN], int n) {
	static double a[MAXN][MAXN], ans[MAXN][MAXN];
	Set(ans, 0);
	For(i, 1, n) ans[i][i] = 1;
	For(i, 1, n) For(j, 1, n) a[i][j] = A[i][j];

	for (; k; k >>= 1) {
		if (k & 1) Mult(ans, a, ans, n);
		Mult(a, a, a, n);
	}
	For(i, 1, n) For(j, 1, n)
		B[i][j] = ans[i][j];
}

int main() {
#ifdef hany01
	freopen("cf446d.in", "r", stdin);
	freopen("cf446d.out", "w", stdout);
#endif

	int n, m, k;
	static int trap[MAXT], ids, istrap[MAXN], id[MAXN];
	static vector<int> G[MAXN];

	n = read<int>(), m = read<int>(), k = read<int>();
	For(i, 1, n)
		if (istrap[i] = read<int>())
			trap[++ ids] = i, id[i] = ids;
	For(i, 1, m) {
		int u = read<int>(), v = read<int>();
		G[u].PB(v), G[v].PB(u);
	}

	static double A[MAXN][MAXN], iA[MAXN][MAXN];
	static double h1[MAXN], w[MAXN][MAXN];

	For(u, 1, n) {
		A[u][u] = 1;
		if (!istrap[u])
			for (int v: G[u])
				A[u][v] -= 1. / SZ(G[u]);
	}
	getInvMatrix(A, iA, n);
	Mult(A, iA, A, n);

	For(i, 1, ids) {
		int u = trap[i];
		for (int v: G[u]) {
			if (istrap[v])
				w[i][id[v]] += 1. / SZ(G[u]);
			else {
				For(j, 1, ids)
					w[i][j] += iA[v][trap[j]] / SZ(G[u]);
			}
		}
	}

	FPM(w, k - 2, w, ids);

	for (int v: G[1]) {
		if (istrap[v])
			h1[id[v]] += 1. / SZ(G[1]);
		else
			For(j, 1, ids)
				h1[j] += iA[v][trap[j]] / SZ(G[1]);
	}
	double ans = 0;
	For(i, 1, ids)
		ans += h1[i] * w[i][ids];

	printf("%.6lf\n", ans);

	return 0;
}

//Step I:
//Get the inverse matrix
//> A * y = x
//> y = A^(-1) * x
//
//Step II:
//Get h[u][v] for each trap u
//
//Step III:
//Calculate w[u][v] through h[u][v]
//
//Step IV:
//Calculate matrix power


/************************************************
 * Au: Hany01
 * Date: Mar 22nd, 2019
 * Prob: cf446d DZY loves games
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 WoXiHuanNiA

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template <typename T> inline T read() {
	register T _, __; register char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ * 10) + (c_ ^ 48);
    return _ * __;
}
//EOT

const int MAXN = 505, MAXT = 105;
const double EPS = 1e-12;

int dcmp(double x) {
	if (fabs(x) < EPS) return 0;
	return x < 0 ? -1 : 1;
}

void printMatrix(double a[][MAXN], int n) {
	For(i, 1, n) {
		For(j, 1, n) printf("%g ", a[i][j]);
		putchar('\n');
	}
	puts("==============");
}

void getInvMatrix(double a[][MAXN], double b[][MAXN], int n) {
	static double A[MAXN][MAXN], B[MAXN][MAXN];

	Set(B, 0);
	For(i, 1, n) {
		For(j, 1, n)
			A[i][j] = a[i][j];
		B[i][i] = 1;
	}

	For(i, 1, n) {
		if (!dcmp(A[i][i])) {
			int flag = 0;
			For(j, i + 1, n)
				if (dcmp(A[j][i])) {
					swap(A[i], A[j]);
					swap(B[i], B[j]);
					flag = 1;
					break;
				}
			assert(flag);
		}

		For(j, i + 1, n)
			if (dcmp(A[j][i])) {
				double d = A[j][i] / A[i][i];
				For(k, i, n)
					A[j][k] = A[j][k] - A[i][k] * d;
				For(k, 1, n)
					B[j][k] = B[j][k] - B[i][k] * d;
				assert(!dcmp(A[j][i]));
			}
	}

	Fordown(i, n, 1) {
		double t = A[i][i];
		For(j, 1, n) B[i][j] = B[i][j] / t;
		A[i][i] = 1;
		For(j, 1, i - 1) {
			double t = A[j][i];
			For(k, 1, n)
				B[j][k] = B[j][k] - B[i][k] * t;
			A[j][i] = 0;
		}
	}

	For(i, 1, n)
		For(j, 1, n)
			b[i][j] = B[i][j];
}

void Mult(double A[][MAXN], double B[][MAXN], double C[][MAXN], int n) {
	static double D[MAXN][MAXN];
	For(i, 1, n) {
		For(j, 1, n) {
			D[i][j] = 0;
			For(k, 1, n)
				D[i][j] += A[i][k] * B[k][j];
		}
	}
	For(i, 1, n) For(j, 1, n)
		C[i][j] = D[i][j];
}

void FPM(double A[][MAXN], int k, double B[][MAXN], int n) {
	static double a[MAXN][MAXN], ans[MAXN][MAXN];
	Set(ans, 0);
	For(i, 1, n) ans[i][i] = 1;
	For(i, 1, n) For(j, 1, n) a[i][j] = A[i][j];

	for (; k; k >>= 1) {
		if (k & 1) Mult(ans, a, ans, n);
		Mult(a, a, a, n);
	}
	For(i, 1, n) For(j, 1, n)
		B[i][j] = ans[i][j];
}

int main() {
#ifdef hany01
	freopen("cf446d.in", "r", stdin);
	freopen("cf446d.out", "w", stdout);
#endif

	int n, m, k;
	static int trap[MAXT], ids, istrap[MAXN], id[MAXN];
	static int G[MAXN][MAXN], deg[MAXN];

	n = read<int>(), m = read<int>(), k = read<int>();
	For(i, 1, n)
		if (istrap[i] = read<int>())
			trap[++ ids] = i, id[i] = ids;
	For(i, 1, m) {
		int u = read<int>(), v = read<int>();
		++ G[u][v], ++ G[v][u];
		++ deg[u], ++ deg[v];
	}

	static double A[MAXN][MAXN], iA[MAXN][MAXN];
	static double h1[MAXN], w[MAXN][MAXN];

	For(u, 1, n) {
		A[u][u] = 1;
		if (!istrap[u])
			For(v, 1, n) if (G[u][v])
				A[u][v] -= 1. * G[u][v] / deg[u];
	}
	getInvMatrix(A, iA, n);
	Mult(A, iA, A, n);

	For(i, 1, ids) {
		int u = trap[i];
		For(v, 1, n) if (G[u][v]) {
			if (istrap[v])
				w[i][id[v]] += 1. * G[u][v] / deg[u];
			else {
				For(j, 1, ids)
					w[i][j] += iA[v][trap[j]] * G[u][v] / deg[u];
			}
		}
	}

	FPM(w, k - 2, w, ids);

	For(v, 1, n) if (G[1][v]) {
		if (istrap[v])
			h1[id[v]] += 1. * G[1][v] / deg[1];
		else
			For(j, 1, ids)
				h1[j] += iA[v][trap[j]] * G[1][v] / deg[1];
	}
	double ans = 0;
	For(i, 1, ids)
		ans += h1[i] * w[i][ids];

	printf("%.6lf\n", ans);

	return 0;
}

//Step I:
//Get the inverse matrix
//> A * y = x
//> y = A^(-1) * x
//
//Step II:
//Get h[u][v] for each trap u
//
//Step III:
//Calculate w[u][v] through h[u][v]
//
//Step IV:
//Calculate matrix power


/************************************************
 * Au: Hany01
 * Date: Mar 22nd, 2019
 * Prob: cf446d DZY loves games
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 WoXiHuanNiA

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template <typename T> inline T read() {
	register T _, __; register char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ * 10) + (c_ ^ 48);
    return _ * __;
}
//EOT

const int MAXN = 505, MAXT = 105;
const LD EPS = 1e-8;

int dcmp(LD x) {
	if (fabs(x) < EPS) return 0;
	return x < 0 ? -1 : 1;
}

void printMatrix(LD a[][MAXN], int n) {
	For(i, 1, n) {
		For(j, 1, n) printf("%g ", a[i][j]);
		putchar('\n');
	}
	putchar('\n');
}

void getInvMatrix(LD a[][MAXN], LD b[][MAXN], int n) {
	static LD A[MAXN][MAXN], B[MAXN][MAXN];

	Set(B, 0);
	For(i, 1, n) {
		For(j, 1, n)
			A[i][j] = a[i][j];
		B[i][i] = 1;
	}

	For(i, 1, n) {
		if (!dcmp(A[i][i])) {
			int flag = 0;
			For(j, i + 1, n)
				if (dcmp(A[j][i])) {
					swap(A[i], A[j]);
					swap(B[i], B[j]);
					flag = 1;
					break;
				}
			assert(flag);
		}

		For(j, i + 1, n)
			if (dcmp(A[j][i])) {
				LD d = A[j][i] / A[i][i];
				For(k, i, n)
					A[j][k] = A[j][k] - A[i][k] * d;
				For(k, 1, n)
					B[j][k] = B[j][k] - B[i][k] * d;
				//assert(!dcmp(A[j][i]));
			}
	}

	Fordown(i, n, 1) {
		LD t = A[i][i];
		For(j, 1, n) B[i][j] = B[i][j] / t;
		A[i][i] = 1;
		For(j, 1, i - 1) {
			LD t = A[j][i];
			For(k, 1, n)
				B[j][k] = B[j][k] - B[i][k] * t;
			A[j][i] = 0;
		}
	}

	For(i, 1, n)
		For(j, 1, n)
			b[i][j] = B[i][j];
}

void Mult(LD A[][MAXN], LD *B, LD *C, int n) {
	static LD D[MAXN];
	For(i, 1, n) {
		D[i] = 0;
		For(j, 1, n)
			D[i] += A[i][j] * B[j];
	}
	For(i, 1, n) C[i] = D[i];
}

void Mult(LD A[][MAXN], LD B[][MAXN], LD C[][MAXN], int n) {
	static LD D[MAXN][MAXN];
	For(i, 1, n) {
		For(j, 1, n) {
			D[i][j] = 0;
			For(k, 1, n)
				D[i][j] += A[i][k] * B[k][j];
		}
	}
	For(i, 1, n) For(j, 1, n)
		C[i][j] = D[i][j];
}

void FPM(LD A[][MAXN], int k, LD B[][MAXN], int n) {
	static LD a[MAXN][MAXN], ans[MAXN][MAXN];
	Set(ans, 0);
	For(i, 1, n) ans[i][i] = 1;
	For(i, 1, n) For(j, 1, n) a[i][j] = A[i][j];

	for (; k; k >>= 1) {
		if (k & 1) Mult(ans, a, ans, n);
		Mult(a, a, a, n);
	}
	For(i, 1, n) For(j, 1, n)
		B[i][j] = ans[i][j];
}

int main() {
#ifdef hany01
	freopen("cf446d.in", "r", stdin);
	freopen("cf446d.out", "w", stdout);
#endif

	int n, m, k;
	static int trap[MAXT], ids, istrap[MAXN], id[MAXN];
	static vector<int> G[MAXN];

	n = read<int>(), m = read<int>(), k = read<int>();
	For(i, 1, n)
		if (istrap[i] = read<int>())
			trap[++ ids] = i, id[i] = ids;
	For(i, 1, m) {
		int u = read<int>(), v = read<int>();
		G[u].PB(v), G[v].PB(u);
	}

	static LD A[MAXN][MAXN], iA[MAXN][MAXN];
	static LD h1[MAXN], w[MAXN][MAXN];

	For(u, 1, n) {
		A[u][u] = 1;
		if (!istrap[u])
			for (int v: G[u])
				A[u][v] -= 1. / SZ(G[u]);
	}
	getInvMatrix(A, iA, n);
	Mult(A, iA, A, n);

	For(i, 1, ids) {
		int u = trap[i];
		for (int v: G[u]) {
			if (istrap[v])
				w[i][id[v]] += 1. / SZ(G[u]);
			else {
				For(j, 1, ids)
					w[i][j] += iA[v][trap[j]] / SZ(G[u]);
			}
		}
	}

	FPM(w, k - 2, w, ids);

	for (int v: G[1]) {
		if (istrap[v])
			h1[id[v]] += 1. / SZ(G[1]);
		else
			For(j, 1, ids)
				h1[j] += iA[v][trap[j]] / SZ(G[1]);
	}
	LD ans = 0;
	For(i, 1, ids)
		ans += h1[i] * w[i][ids];

	printf("%.6Lf\n", ans);

	return 0;
}

//Step I:
//Get the inverse matrix
//> A * y = x
//> y = A^(-1) * x
//
//Step II:
//Get h[u][v] for each trap u
//
//Step III:
//Calculate w[u][v] through h[u][v]
//
//Step IV:
//Calculate matrix power


/************************************************
 * Au: Hany01
 * Date: Mar 22nd, 2019
 * Prob: cf446d DZY loves games
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 WoXiHuanNiA

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template <typename T> inline T read() {
	register T _, __; register char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ * 10) + (c_ ^ 48);
    return _ * __;
}
//EOT

const int MAXN = 505, MAXT = 105;
const double EPS = 1e-12;

int dcmp(double x) {
	if (fabs(x) < EPS) return 0;
	return x < 0 ? -1 : 1;
}

void printMatrix(double a[][MAXN], int n) {
	For(i, 1, n) {
		For(j, 1, n) printf("%g ", a[i][j]);
		putchar('\n');
	}
	puts("==============");
}

void getInvMatrix(double a[][MAXN], double b[][MAXN], int n) {
	static double A[MAXN][MAXN], B[MAXN][MAXN];

	Set(B, 0);
	For(i, 1, n) {
		For(j, 1, n)
			A[i][j] = a[i][j];
		B[i][i] = 1;
	}

	For(i, 1, n) {
		if (!dcmp(A[i][i])) {
			int flag = 0;
			For(j, i + 1, n)
				if (dcmp(A[j][i])) {
					swap(A[i], A[j]);
					swap(B[i], B[j]);
					flag = 1;
					break;
				}
			assert(flag);
		}

		For(j, i + 1, n)
			if (dcmp(A[j][i])) {
				double d = A[j][i] / A[i][i];
				For(k, i, n)
					A[j][k] = A[j][k] - A[i][k] * d;
				For(k, 1, n)
					B[j][k] = B[j][k] - B[i][k] * d;
				assert(!dcmp(A[j][i]));
			}
	}

	Fordown(i, n, 1) {
		double t = A[i][i];
		For(j, 1, n) B[i][j] = B[i][j] / t;
		A[i][i] = 1;
		For(j, 1, i - 1) {
			double t = A[j][i];
			For(k, 1, n)
				B[j][k] = B[j][k] - B[i][k] * t;
			A[j][i] = 0;
		}
	}

	For(i, 1, n)
		For(j, 1, n)
			b[i][j] = B[i][j];
}

void Mult(double A[][MAXN], double B[][MAXN], double C[][MAXN], int n) {
	static double D[MAXN][MAXN];
	For(i, 1, n) {
		For(j, 1, n) {
			D[i][j] = 0;
			For(k, 1, n)
				D[i][j] += A[i][k] * B[k][j];
		}
	}
	For(i, 1, n) For(j, 1, n)
		C[i][j] = D[i][j];
}

void FPM(double A[][MAXN], int k, double B[][MAXN], int n) {
	static double a[MAXN][MAXN], ans[MAXN][MAXN];
	Set(ans, 0);
	For(i, 1, n) ans[i][i] = 1;
	For(i, 1, n) For(j, 1, n) a[i][j] = A[i][j];

	for (; k; k >>= 1) {
		if (k & 1) {
			Mult(ans, a, ans, n);
			printMatrix(ans, n);
		}
		Mult(a, a, a, n);
	}
	For(i, 1, n) For(j, 1, n)
		B[i][j] = ans[i][j];
}

int main() {
#ifdef hany01
	freopen("cf446d.in", "r", stdin);
	freopen("cf446d.out", "w", stdout);
#endif

	int n, m, k;
	static int trap[MAXT], ids, istrap[MAXN], id[MAXN];
	static int G[MAXN][MAXN], deg[MAXN];

	n = read<int>(), m = read<int>(), k = read<int>();
	For(i, 1, n)
		if (istrap[i] = read<int>())
			trap[++ ids] = i, id[i] = ids;
	For(i, 1, m) {
		int u = read<int>(), v = read<int>();
		++ G[u][v], ++ G[v][u];
		++ deg[u], ++ deg[v];
	}

	static double A[MAXN][MAXN], iA[MAXN][MAXN];
	static double h1[MAXN], w[MAXN][MAXN];

	For(u, 1, n) {
		A[u][u] = 1;
		if (!istrap[u])
			For(v, 1, n) if (G[u][v])
				A[u][v] -= 1. * G[u][v] / deg[u];
	}
	getInvMatrix(A, iA, n);
	Mult(A, iA, A, n);

	For(i, 1, ids) {
		int u = trap[i];
		For(v, 1, n) if (G[u][v]) {
			if (istrap[v])
				w[i][id[v]] += 1. * G[u][v] / deg[u];
			else {
				For(j, 1, ids)
					w[i][j] += iA[v][trap[j]] * G[u][v] / deg[u];
			}
		}
	}

	FPM(w, k - 2, w, ids);

	For(v, 1, n) if (G[1][v]) {
		if (istrap[v])
			h1[id[v]] += 1. * G[1][v] / deg[1];
		else
			For(j, 1, ids)
				h1[j] += iA[v][trap[j]] * G[1][v] / deg[1];
	}
	double ans = 0;
	For(i, 1, ids)
		ans += h1[i] * w[i][ids];

	printf("%.6lf\n", ans);

	return 0;
}

//Step I:
//Get the inverse matrix
//> A * y = x
//> y = A^(-1) * x
//
//Step II:
//Get h[u][v] for each trap u
//
//Step III:
//Calculate w[u][v] through h[u][v]
//
//Step IV:
//Calculate matrix power


#include<bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const int MAXN=510;
const int MAXS=110;
const int MAXM=1E5+10;
const double EPS=1E-8;

int siz,n,m,k,ban[MAXN],pos[MAXN],U[MAXM],V[MAXM],d[MAXN],id[MAXN];
vector<int> G[MAXN];

struct Mat{
	double a[MAXS][MAXS];

	Mat(){memset(a,0,sizeof a);}

	double* operator [](int x){return a[x];}
	const double* operator [](int x) const {return a[x];}

	Mat operator * (const Mat &rhs) const
	{
		Mat ret;
		for(int i=0;i<=siz;i++)
			for(int j=0;j<=siz;j++)
				for(int k=0;k<=siz;k++)
					ret[i][j]+=a[i][k]*rhs[k][j];
		return ret;
	}
}trans;

Mat ksm(Mat a,ll b)
{
	Mat ret;
	for(int i=0;i<=siz;i++)
		ret[i][i]=1;
	for(;b;b>>=1,a=a*a)
		if(b&1)
			ret=ret*a;
	return ret;
}

double A[MAXN][MAXN<<1],C[MAXN],X[MAXN];

void Guass()
{
	for(int i=1;i<=n;i++)
	{
		int pos=i;
		for(int j=i+1;j<=n;j++)
			if(abs(A[j][i])>abs(A[pos][i]))
				pos=j;
		if(abs(A[pos][i])<EPS)
			throw "No Matrix Inverse";
		for(int j=1;j<=2*n;j++)
			swap(A[pos][j],A[i][j]);
		for(int j=i+1;j<=n;j++)
		{
			if(abs(A[j][i])<EPS)
				continue;
			double coef=A[j][i]/A[i][i];
			for(int k=1;k<=2*n;k++)
				A[j][k]-=A[i][k]*coef;
		}
	}
	for(int i=n;i;i--)
	{
		double inv=1.0/A[i][i];
		for(int j=1;j<=2*n;j++)
			A[i][j]=A[i][j]*inv;
		for(int j=i-1;j;j--)
		{
			double coef=A[j][i]/A[i][i];
			for(int k=1;k<=2*n;k++)
				A[j][k]-=A[i][k]*coef;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			swap(A[i][j],A[i][j+n]);
}

void solve()
{
	for(int i=1;i<=n;i++)
		X[i]=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			X[j]+=C[i]*A[j][i];
}

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	pos[++siz]=1;id[1]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ban[i]);
		if(ban[i])
			pos[++siz]=i,
			id[i]=siz;
	}
	for(int i=1;i<=n;i++)
		A[i][i]=A[i][i+n]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&U[i],&V[i]);
		G[U[i]].push_back(V[i]);
		G[V[i]].push_back(U[i]);
		++d[U[i]];++d[V[i]];
	}
	for(int i=1;i<=m;i++)
	{
		int u=U[i],v=V[i];
		if(!ban[u])
			A[v][u]-=1.0/d[u];
		if(!ban[v])
			A[u][v]-=1.0/d[v];
	}
	Guass();
	for(int i=1;i<=siz;i++)
	{
		memset(C,0,sizeof C);
		int x=pos[i];
		if(x==1)
			C[1]=1,solve();
		else
		{
			C[x]=1;
			for(int v:G[x])
				C[v]+=1.0/d[x];
			solve();
		}
		double tot=1;
		for(int j=1;j<=n;j++)
			if(ban[j]&&j!=x)
				trans[i][id[j]]=X[j],tot-=X[j];
		trans[i][i]=tot;
	}
	trans[siz][0]=1;
	Mat res;
	res[0][1]=1;
	res=res*ksm(trans,k);
	printf("%.10lf\n",res[0][0]);
}


#include<bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const int MAXN=510;
const int MAXS=110;
const int MAXM=1E5+10;
const double EPS=1E-8;

int siz,n,m,k,ban[MAXN],pos[MAXN],U[MAXM],V[MAXM],d[MAXN],id[MAXN];
vector<int> G[MAXN];

struct Mat{
	double a[MAXS][MAXS];

	Mat(){memset(a,0,sizeof a);}

	double* operator [](int x){return a[x];}
	const double* operator [](int x) const {return a[x];}

	Mat operator * (const Mat &rhs) const
	{
		Mat ret;
		for(int i=0;i<=siz;i++)
			for(int j=0;j<=siz;j++)
				for(int k=0;k<=siz;k++)
					ret[i][j]+=a[i][k]*rhs[k][j];
		return ret;
	}
}trans;

Mat ksm(Mat a,ll b)
{
	Mat ret;
	for(int i=0;i<=siz;i++)
		ret[i][i]=1;
	for(;b;b>>=1,a=a*a)
		if(b&1)
			ret=ret*a;
	return ret;
}

double A[MAXN][MAXN<<1],C[MAXN],X[MAXN];

void Guass()
{
	for(int i=1;i<=n;i++)
	{
		int pos=i;
		for(int j=i+1;j<=n;j++)
			if(abs(A[j][i])>abs(A[pos][i]))
				pos=j;
		if(abs(A[pos][i])<EPS)
			throw "No Matrix Inverse";
		for(int j=1;j<=2*n;j++)
			swap(A[pos][j],A[i][j]);
		for(int j=i+1;j<=n;j++)
		{
			if(abs(A[j][i])<EPS)
				continue;
			double coef=A[j][i]/A[i][i];
			for(int k=1;k<=2*n;k++)
				A[j][k]-=A[i][k]*coef;
		}
	}
	for(int i=n;i;i--)
	{
		double inv=1.0/A[i][i];
		for(int j=1;j<=2*n;j++)
			A[i][j]=A[i][j]*inv;
		for(int j=i-1;j;j--)
		{
			double coef=A[j][i]/A[i][i];
			for(int k=1;k<=2*n;k++)
				A[j][k]-=A[i][k]*coef;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			swap(A[i][j],A[i][j+n]);
}

void solve()
{
	for(int i=1;i<=n;i++)
		X[i]=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			X[j]+=C[i]*A[j][i];
}

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	pos[++siz]=1;id[1]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ban[i]);
		if(ban[i])
			pos[++siz]=i,
			id[i]=siz;
	}
	for(int i=1;i<=n;i++)
		A[i][i]=A[i][i+n]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&U[i],&V[i]);
		G[U[i]].push_back(V[i]);
		G[V[i]].push_back(U[i]);
		++d[U[i]];++d[V[i]];
	}
	for(int i=1;i<=m;i++)
	{
		int u=U[i],v=V[i];
		if(!ban[u])
			A[v][u]-=1.0/d[u];
		if(!ban[v])
			A[u][v]-=1.0/d[v];
	}
	Guass();
	for(int i=1;i<=siz;i++)
	{
		memset(C,0,sizeof C);
		int x=pos[i];
		if(x==1)
			C[1]=1,solve();
		else
		{
			C[x]=1;
			for(int v:G[x])
				C[v]+=1.0/d[x];
			solve();
		}
		double tot=1;
		for(int j=1;j<=n;j++)
			if(ban[j]&&j!=x)
				trans[i][id[j]]=X[j],tot-=X[j];
		trans[i][i]=tot;
	}
	trans[siz][0]=1;
	Mat res;
	res[0][1]=1;
	res=res*ksm(trans,k);
	printf("%.10lf\n",res[0][0]);
}
//CZY AKIOI


#include<bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const int MAXN=510;
const int MAXS=110;
const int MAXM=1E5+10;
const double EPS=1E-8;

int siz,n,m,k,ban[MAXN],pos[MAXN],U[MAXM],V[MAXM],d[MAXN],id[MAXN];
vector<int> G[MAXN];

struct Mat{
	double a[MAXS][MAXS];

	Mat(){memset(a,0,sizeof a);}

	double* operator [](int x){return a[x];}
	const double* operator [](int x) const {return a[x];}

	Mat operator * (const Mat &rhs) const
	{
		Mat ret;
		for(int i=0;i<=siz;i++)
			for(int j=0;j<=siz;j++)
				for(int k=0;k<=siz;k++)
					ret[i][j]+=a[i][k]*rhs[k][j];
		return ret;
	}
}trans;

Mat ksm(Mat a,ll b)
{
	Mat ret;
	for(int i=0;i<=siz;i++)
		ret[i][i]=1;
	for(;b;b>>=1,a=a*a)
		if(b&1)
			ret=ret*a;
	return ret;
}

double A[MAXN][MAXN<<1],C[MAXN],X[MAXN];

void Guass()
{
	for(int i=1;i<=n;i++)
	{
		int pos=i;
		for(int j=i+1;j<=n;j++)
			if(abs(A[j][i])>abs(A[pos][i]))
				pos=j;
		if(abs(A[pos][i])<EPS)
			throw "No Matrix Inverse";
		for(int j=1;j<=2*n;j++)
			swap(A[pos][j],A[i][j]);
		for(int j=i+1;j<=n;j++)
		{
			if(abs(A[j][i])<EPS)
				continue;
			double coef=A[j][i]/A[i][i];
			for(int k=1;k<=2*n;k++)
				A[j][k]-=A[i][k]*coef;
		}
	}
	for(int i=n;i;i--)
	{
		double inv=1.0/A[i][i];
		for(int j=1;j<=2*n;j++)
			A[i][j]=A[i][j]*inv;
		for(int j=i-1;j;j--)
		{
			double coef=A[j][i]/A[i][i];
			for(int k=1;k<=2*n;k++)
				A[j][k]-=A[i][k]*coef;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			swap(A[i][j],A[i][j+n]);
}

void solve()
{
	for(int i=1;i<=n;i++)
		X[i]=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			X[j]+=C[i]*A[j][i];
}

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	pos[++siz]=1;id[1]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ban[i]);
		if(ban[i])
			pos[++siz]=i,
			id[i]=siz;
	}
	for(int i=1;i<=n;i++)
		A[i][i]=A[i][i+n]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&U[i],&V[i]);
		G[U[i]].push_back(V[i]);
		G[V[i]].push_back(U[i]);
		++d[U[i]];++d[V[i]];
	}
	for(int i=1;i<=m;i++)
	{
		int u=U[i],v=V[i];
		if(!ban[u])
			A[v][u]-=1.0/d[u];
		if(!ban[v])
			A[u][v]-=1.0/d[v];
	}
	Guass();
	for(int i=1;i<=siz;i++)
	{
		memset(C,0,sizeof C);
		int x=pos[i];
		if(x==1)
			C[1]=1,solve();
		else
		{
			C[x]=1;
			for(int v:G[x])
				C[v]+=1.0/d[x];
			solve();
		}
		for(int j=1;j<=n;j++)
			if(ban[j])
				trans[i][id[j]]=X[j]-(j==x);
	}
	trans[siz][0]=1;
	Mat res;
	res[0][1]=1;
	res=res*ksm(trans,k);
	printf("%.10lf\n",res[0][0]);
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include <iostream>
#include <cstdio>
#include <cstring>
#define eps 1e-10
#define abs(_o) ((_o < 0) ? -(_o) : (_o))
using namespace std;
namespace ywy {
    inline int get() {
        int n = 0;
        char c;
        while ((c = getchar()) || 23333) {
            if (c >= '0' && c <= '9')
                break;
            if (c == '-')
                goto s;
        }
        n = c - '0';
        while ((c = getchar()) || 23333) {
            if (c >= '0' && c <= '9')
                n = n * 10 + c - '0';
            else
                return (n);
        }
    s:
        while ((c = getchar()) || 23333) {
            if (c >= '0' && c <= '9')
                n = n * 10 - c + '0';
            else
                return (n);
        }
    }
    int sz;
    typedef struct _vector {
        double vec[111];
        _vector() { memset(vec, 0, sizeof(vec)); }
        friend _vector operator+(const _vector &a, const _vector &b) {
            _vector c = a;
            for (register int i = 1; i <= sz; i++) c.vec[i] += b.vec[i];
            return (c);
        }
        friend _vector operator-(const _vector &a, const _vector &b) {
            _vector c = a;
            for (register int i = 1; i <= sz; i++) c.vec[i] -= b.vec[i];
            return (c);
        }
        friend _vector operator*(const _vector &a, const double &b) {
            _vector c = a;
            for (register int i = 1; i <= sz; i++) c.vec[i] *= b;
            return (c);
        }
        friend _vector operator/(const _vector &a, const double &b) {
            _vector c = a;
            for (register int i = 1; i <= sz; i++) c.vec[i] /= b;
            return (c);
        }
    } vector;
    double v[666][666];
    vector vec[666];
    int n;
    typedef struct _mx {
        double v[166][166];
        _mx() { memset(v, 0, sizeof(v)); }
        friend _mx operator*(const _mx &a, const _mx &b) {
            _mx c;
            for (register int i = 0; i <= sz; i++) {
                for (register int k = 0; k <= sz; k++) {
                    for (register int j = 0; j <= sz; j++) c.v[i][j] += a.v[i][k] * b.v[k][j];
                }
            }
            return (c);
        }
    } mx;
    unsigned char trap[655];
    inline mx mi(mx &a, int b) {
        mx ans, tmp = a;
        for (register int i = 0; i <= sz; i++) ans.v[i][i] = 1;
        while (b) {
            if (b & 1)
                ans = ans * tmp;
            tmp = tmp * tmp;
            b >>= 1;
        }
        return (ans);
    }
    int deg[555];
    int g[555][555], lxl[555], fan[555];
    int xs[666];
    void ywymain() {
        n = get();
        int m = get(), k = get();
        for (register int i = 1; i <= n; i++) sz += (trap[i] = get());
        for (register int i = 1; i <= m; i++) {
            int s = get(), t = get();
            deg[s]++;
            deg[t]++;
            g[s][t]++;
            g[t][s]++;
        }
        int ptr = 1;
        for (register int i = 1; i <= n; i++)
            if (trap[i])
                lxl[ptr] = i, fan[i] = ptr, ptr++;
        ptr--;
        for (register int i = 1; i <= n; i++) {
            v[i][i] = -1;
            for (register int j = 1; j <= n; j++) {
                if (trap[j])
                    v[i][fan[j] + n] += g[i][j] / (double)deg[i];
                else
                    v[i][j] += g[i][j] / (double)deg[i];
            }
        }
        for (register int i = 1; i <= ptr; i++) {
            vec[i + n].vec[i] = 1;
            v[i + n][i + n] = 1;
        }
        for (register int i = 1; i <= n + ptr; i++) {
            int me = -1;
            double mx = 0;
            for (register int j = 1; j <= n + ptr; j++)
                if (abs(v[i][j]) > mx)
                    mx = abs(v[i][j]), me = j;
            if (me == -1 || abs(mx) < eps)
                continue;
            xs[i] = me;
            double cjr = v[i][me];
            for (register int j = 1; j <= n + ptr; j++) v[i][j] /= cjr;
            vec[i] = vec[i] / cjr;
            for (register int j = 1; j <= n + ptr; j++) {
                if (j == i || abs(v[j][me]) < eps)
                    continue;
                double cjr = v[j][me];
                for (register int k = 1; k <= n + ptr; k++) v[j][k] -= v[i][k] * cjr;
                vec[j] = vec[j] - vec[i] * cjr;
            }
        }
        mx dk;
        for (register int i = 1; i <= n + ptr; i++) {
            if ((xs[i] <= n && trap[xs[i]]) || xs[i] == 1) {
                if (xs[i] == 1) {
                    for (register int j = 1; j <= ptr; j++) dk.v[0][j] = vec[i].vec[j];
                } else
                    for (register int j = 1; j <= ptr; j++) dk.v[fan[xs[i]]][j] = vec[i].vec[j];
            }
        }
        mx res = mi(dk, k - 1);
        printf("%.10lf\n", res.v[0][fan[n]]);
    }
}
int main() {
    ywy::ywymain();
    return (0);
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define N 105
#define M 505
using namespace std;
int main()
{
	double v=0.0;
	v=v/v;
	printf("%.6lf",v);
}


#pragma region
#ifndef M207
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#endif
#include <bits/stdc++.h>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define uint unsigned int
#define ull unsigned long long
#define solid const auto &
#define pb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
#define gm int mid((l+r)/2)
#define space putchar(' ')
#define enter putchar('\n')
#define rd() ({ri t;in(t);t;})
#define Size(x) ((int)x.size())
#define mem(x,y) memset(x,y,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; char c=getchar(); bool f=0;
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=x*10+(c^'0'),c=getchar();
	f?x=-x:0;
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[40]; short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template<class T>il void err(const T &x,const char c='\n') {cerr<<x<<c;}
template<class T,class ...Args>il void in(T &x,Args &...args) {in(x); in(args...);}
template<class T,class ...Args>il void out(const T &x,const Args &...args) {out(x,' '); out(args...);}
template<class T,class ...Args>il void err(const T &x,const Args &...args) {err(x,' '); err(args...);}
template<class T>il void prt(T a,int n) {for(ri i=0; i<n; ++i) out(a[i],i==n-1?'\n':' ');}
template<class T>il void clr(T a[],int n) {memset(a,0,sizeof(T)*n);}
template<class T>il void clr(T *a,T *b) {memset(a,0,sizeof(T)*(b-a));}
template<class T>il bool ckmax(T &a,const T &b) {return a<b?a=b,1:0;}
template<class T>il bool ckmin(T &a,const T &b) {return a>b?a=b,1:0;}
// namespace MOD_CALC
// {
// const int md=1e9+7;
// il int add(const int a,const int b) {return a+b>=md?a+b-md:a+b;}
// il int sub(const int a,const int b) {return a-b<0?a-b+md:a-b;}
// il int mul(const int a,const int b) {return (LL)a*b%md;}
// il void inc(int &a,const int b) {(a+=b)>=md?a-=md:0;}
// il void dec(int &a,const int b) {(a-=b)<0?a+=md:0;}
// il int qpow(int a,int b) {int r=1; for(; b; b>>=1,a=mul(a,a)) if(b&1) r=mul(r,a); return r;}
// il int qpow(int a,int b,const int p) {int r=1; for(; b; b>>=1,a=(LL)a*a%p) if(b&1) r=(LL)r*a%p; return r;}
// il int mdinv(const int a) {return qpow(a,md-2);}
// template<class ...Args>il int add(const int a,const int b,const Args &...args) {return add(add(a,b),args...);}
// template<class ...Args>il int mul(const int a,const int b,const Args &...args) {return mul(mul(a,b),args...);}
// } using namespace MOD_CALC;
namespace i207M
{
#pragma endregion
#define N 605
#define M 105
#define eps 1e-8
int sz;
il void mul(double a[M][M],double b[M][M],double c[M][M])
{
	static double t[M][M];
	for(ri i=0; i<sz; ++i)
		for(ri k=0; k<sz; ++k)
			for(ri j=0; j<sz; ++j)
				t[i][j]+=a[i][k]*b[k][j];
	for(ri i=0; i<sz; ++i)
		for(ri j=0; j<sz; ++j) c[i][j]=t[i][j],t[i][j]=0;
}
il void mul2(double a[M],double b[M][M],double c[M])
{
	static double t[M];
	for(ri k=0; k<sz; ++k)
		for(ri j=0; j<sz; ++j)
			t[j]+=a[k]*b[k][j];
	for(ri j=0; j<sz; ++j) c[j]=t[j],t[j]=0;
}
int n,m,K;
int a[N];
int id[N],tot;
double g[N][N];
double d[M],c[M][M];
void gauss()
{
	for(ri i=1; i<=n; ++i)
	{
		if(abs(g[i][i])<eps)
		{
			for(ri j=i+1; j<=n; ++j)
				if(abs(g[j][i])>eps)
				{
					for(ri k=tot; k>=i; --k) swap(g[i][k],g[j][k]);
					break;
				}
		}
		for(ri j=tot; j>=i; --j) g[i][j]/=g[i][i];
		for(ri j=1; j<=n; ++j)
			if(j!=i&&abs(g[j][i])>eps)
				for(ri k=tot; k>=i; --k) g[j][k]-=g[j][i]*g[i][k];
	}
	for(ri i=1; i<=tot-n; ++i) d[i-1]=g[1][n+i];
	for(ri i=1; i<=n; ++i)
		if(a[i]) for(ri j=1; j<=tot-n; ++j) c[id[i]-n-1][j-1]=g[i][n+j];
}
void solve()
{
	K-=2; sz=tot-n;
	for(; K; K>>=1,mul(c,c,c)) if(K&1) mul2(d,c,d);
	printf("%.10f\n",d[id[n]-n-1]);
}
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("ot.out","w",stdout);
#endif
	in(n,m,K);
	tot=n;
	for(ri i=1; i<=n; ++i)
		if(rd()) a[i]=1,id[i]=++tot;
	for(ri i=1,u,v; i<=m; ++i)
	{
		in(u,v);
		if(a[v]) g[u][id[v]]-=1;
		else g[u][v]+=1;
		g[u][u]-=1;
		if(a[u]) g[v][id[u]]-=1;
		else g[v][u]+=1;
		g[v][v]-=1;
	}
	gauss();
	solve();
	return 0;
}
#pragma region


#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define db double
#define abs(x) ((x < 0)?-(x):(x))
using namespace std;
inline char ch(){
	static char s[1<<16],*S,*T;
	return (S==T)&&(T=(S=s)+fread(s,1,1<<16,stdin),S==T)?EOF:*S++;
}
template<typename T> void read(T &x){
	x = 0; int f(1); char c = ch();
	for(;!isdigit(c);c = ch()) if(c == '-') f = -1;
	for(;isdigit(c);c = ch()) x = x*10+c-'0';
	x *= f;
}
template<typename T> void write(T x,int f = 1){
	if(x < 0)	putchar('-'),x = -x;
	if(x > 9)	write(x/10,0);
	putchar('0'+x%10);
	if(f)	puts("");
}
const int maxn = 667;
const db eps = 1e-9;
inline bool cal(double x){return x <= eps;}
int n,m,K,tr[maxn],tot;
int id[maxn],idf[maxn],xs[maxn];
db V[maxn][maxn];
int deg[maxn],e[maxn][maxn];
struct Vector{
	db A[167];
	Vector(){memset(A,0,sizeof A);}
}Vec[maxn];
Vector operator +(const Vector &y,const Vector &x){
	Vector ret;
	for(int j(0);j <= tot;++j)
		ret.A[j] = y.A[j]+x.A[j];
	return ret;
}
Vector operator -(const Vector &y,const Vector &x){
	Vector ret;
	for(int j(0);j <= tot;++j)
		ret.A[j] = y.A[j]-x.A[j];
	return ret;
}
Vector Mul(Vector x,double y){
	Vector ret;
	for(int j(0);j <= tot;++j)
		ret.A[j] = x.A[j]*y;
	return ret;
}
Vector Div(Vector x,double y){
	Vector ret;
	for(int j(0);j <= tot;++j)
		ret.A[j] = x.A[j]/y;
	return ret;
}
struct matrix{
	db A[167][167];
	matrix(){memset(A,0,sizeof A);}
	void init(){
		for(int i(0);i <= tot;++i)
			A[i][i] = 1;
	}
};
matrix operator *(const matrix &y,const matrix &x){
	matrix ret;
	for(int i(0);i <= tot;++i)
	for(int j(0);j <= tot;++j)
	for(int k(0);k <= tot;++k)
		ret.A[i][j] += y.A[i][k]*x.A[k][j];
	return ret;
}
matrix qp(matrix a,int b){
	matrix ret; ret.init();
	while(b){
		if(b&1)	ret = ret*a;
		a = a*a; b >>= 1;
	} return ret;
}
int main(){
	read(n); read(m); read(K);
	for(int i(1);i <= n;++i)	read(tr[i]);
	for(int i(1);i <= m;++i){
		int u,v; read(u);
		read(v); ++deg[u],++deg[v];
		++e[u][v]; ++e[v][u];
	}
	for(int i(1);i <= n;++i)
		if(tr[i])	id[++tot] = i,idf[i] = tot;
	for(int i(1);i <= n;++i){
		V[i][i] = -1;
		for(int j(1);j <= n;++j)
			if(tr[j])	V[i][idf[j]+n] += 1.0*e[i][j]/deg[i];
			else		V[i][j] += 1.0*e[i][j]/deg[i];
	}
	for(int i(1);i <= tot;++i)
		Vec[i+n].A[i] = 1.0,
		V[i+n][i+n] = 1.0;
	for(int i(1);i <= n+tot;++i){
		int mxj = -1; db mx = 0;
		for(int j(1);j <= n+tot;++j)
			if(abs(V[i][j]) > mx)
				mx = abs(V[i][j]),mxj = j;
		if(mxj == -1||mx <= eps)	continue;
		xs[i] = mxj; db tmp = V[i][mxj];
		for(int j(1);j <= n+tot;++j)	V[i][j] /= tmp;
		Vec[i] = Div(Vec[i],tmp);
		for(int j(1);j <= n+tot;++j){
			if(j == i||cal(abs(V[j][mxj])))	continue;
			tmp = V[j][mxj];
			for(int k(1);k <= n+tot;++k)
				V[j][k] -= V[i][k]*tmp;
			Vec[j] = Vec[j]-Mul(Vec[i],tmp);
		}
	}
	matrix ans;
	for(int i(1);i <= n+tot;++i)
		if(xs[i] == 1||(xs[i] <= n&&tr[xs[i]])){
			if(xs[i] == 1){for(int j(1);j <= tot;++j)
				ans.A[0][j] = Vec[i].A[j];}
			else{for(int j(1);j <= tot;++j)
				ans.A[idf[xs[i]]][j] = Vec[i].A[j];}
		}
	ans = qp(ans,K-1); printf("%.8lf\n",ans.A[0][idf[n]]);
	return 0;
}


#include <bits/stdc++.h>
#define db double
using namespace std;
inline char ch(){
	static char s[1<<16],*S,*T;
	return (S==T)&&(T=(S=s)+fread(s,1,1<<16,stdin),S==T)?EOF:*S++;
}
template<typename T> void read(T &x){
	x = 0; int f(1); char c = ch();
	for(;!isdigit(c);c = ch()) if(c == '-') f = -1;
	for(;isdigit(c);c = ch()) x = x*10+c-'0';
	x *= f;
}
template<typename T> void write(T x,int f = 1){
	if(x < 0)	putchar('-'),x = -x;
	if(x > 9)	write(x/10,0);
	putchar('0'+x%10);
	if(f)	puts("");
}
const int maxn = 505;
const db eps = 1e-9;
int n,m,K,tr[maxn],tot;
int id[maxn],idf[maxn],xs[maxn*2];
db V[maxn*2][maxn*2];
int deg[maxn],e[maxn][maxn];
struct Vector{
	db A[maxn];
	Vector(){memset(A,0,sizeof A);}
}Vec[maxn];
Vector operator +(const Vector &y,const Vector &x){
	Vector ret;
	for(int j(1);j <= tot;++j)
		ret.A[j] = y.A[j]+x.A[j];
	return ret;
}
Vector operator -(const Vector &y,const Vector &x){
	Vector ret;
	for(int j(1);j <= tot;++j)
		ret.A[j] = y.A[j]-x.A[j];
	return ret;
}
Vector Mul(Vector x,db y){
	Vector ret;
	for(int j(1);j <= tot;++j)
		ret.A[j] = x.A[j]*y;
	return ret;
}
Vector Div(Vector x,db y){
	Vector ret;
	for(int j(1);j <= tot;++j)
		ret.A[j] = x.A[j]/y;
	return ret;
}
struct matrix{
	db A[maxn][maxn];
	matrix(){memset(A,0,sizeof A);}
	void init(){
		for(int i(0);i <= tot;++i)
			A[i][i] = 1;
	}
};
matrix operator *(const matrix &y,const matrix &x){
	matrix ret;
	for(int i(0);i <= tot;++i)
	for(int j(0);j <= tot;++j)
	for(int k(0);k <= tot;++k)
		ret.A[i][j] += y.A[i][k]*x.A[k][j];
	return ret;
}
matrix qp(matrix a,int b){
	matrix ret; ret.init();
	while(b){
		if(b&1)	ret = ret*a;
		a = a*a; b >>= 1;
	} return ret;
}
int main(){
	read(n); read(m); read(K);
	for(int i(1);i <= n;++i)	read(tr[i]);
	for(int i(1);i <= m;++i){
		int u,v; read(u);
		read(v); ++deg[u],++deg[v];
		++e[u][v]; ++e[v][u];
	}
	for(int i(1);i <= n;++i)
		if(tr[i])	id[++tot] = i,idf[i] = tot;
	for(int i(1);i <= n;++i){
		V[i][i] = -1;
		for(int j(1);j <= n;++j)
			if(tr[j])	V[i][idf[j]+n] += 1.0*e[i][j]/deg[i];
			else		V[i][j] += 1.0*e[i][j]/deg[i];
	}
	for(int i(1);i <= tot;++i)
		Vec[i+n].A[i] = 1.0,V[i+n][i+n] = 1.0;
	for(int i(1);i <= n+tot;++i){
		int mxj = -1; db mx = 0;
		for(int j(1);j <= n+tot;++j)
			if(abs(V[i][j]) > mx)
				mx = abs(V[i][j]),mxj = j;
		if(mxj == -1||mx <= eps)	continue;
		xs[i] = mxj; db tmp = V[i][mxj];
		for(int j(1);j <= n+tot;++j)	V[i][j] /= tmp;
		Vec[i] = Div(Vec[i],tmp);
		for(int j(1);j <= n+tot;++j){
			if(j == i||abs(V[j][mxj]) <= eps)	continue;
			tmp = V[j][mxj];
			for(int k(1);k <= n+tot;++k)
				V[j][k] -= V[i][k]*tmp;
			Vec[j] = Vec[j]-Mul(Vec[i],tmp);
		}
	}
	matrix ans;
	for(int i(1);i <= n+tot;++i)
		if(xs[i] == 1||(xs[i] <= n&&tr[xs[i]])){
			if(xs[i] == 1){for(int j(1);j <= tot;++j)
				ans.A[0][j] = Vec[i].A[j];}
			else{for(int j(1);j <= tot;++j)
				ans.A[idf[xs[i]]][j] = Vec[i].A[j];}
		}
	ans = qp(ans,K-1); printf("%.8lf\n",ans.A[0][idf[n]]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 605;
int n,m,kk,a[N],idx,num[N],u[N],v[N],deg[N];
double f[N][N];
void Gauss()
{
    for (int i = 1;i <= n;i++)
    {
        if (!f[i][i])
        {
            int mx = i;
            for (int j = i + 1;j <= n;j++) if (abs(f[j][i]) > abs(f[mx][i])) mx = j;
            if (mx != i) for (int j = i + 1;j <= n + idx + 1;j++) swap(f[mx][j],f[i][j]);
        }
        if (!f[i][i]) continue;
        double tmp = f[i][i];
        for (int j = i;j <= n + idx + 1;j++) f[j][i] /= tmp;
        for (int j = 1;j <= n;j++)
            if (j != i && f[j][i])
            {
                tmp = f[j][i];
                for (int k = i;k <= n + idx + 1;k++) f[j][k] -= tmp * f[i][k];
            }
    }
}
struct Matrix
{
    int l,w;
    double a[N][N] = {};
    double *operator[](const size_t &s) {return a[s];}
    const double *operator[](const size_t &s) const {return a[s];}
    Matrix (int l,int w) :l(l),w(w) {}
};
Matrix operator* (const Matrix &a,const Matrix &b)
{
    Matrix c(a.l,b.w);
    for (int i = 1;i <= a.l;i++)
        for (int j = 1;j <= b.w;j++)
            for (int k = 1;k <= a.w;k++) c[i][j] = (c[i][j] + a[i][k] * b[k][j]);
    return c;
}
Matrix qpow(Matrix a,int b)
{
    Matrix ret(a.l,a.w);
    for (int i = 1;i <= a.l;i++) ret[i][i] = 1;
    while (b)
    {
        if (b & 1) ret = ret * a;
        a = a * a;b >>= 1;
    }
    return ret;
}
int main ()
{
    ios::sync_with_stdio(false);
    cin >> n >> m >> kk;
    for (int i = 1;i <= n;i++) { cin >> a[i];if (a[i]) a[i] = ++idx,num[idx] = i; }
    for (int i = 1;i <= m;i++) cin >> u[i] >> v[i],++deg[u[i]],++deg[v[i]];
    for (int i = 1;i <= m;i++)
    {
        int x = u[i],y = v[i];
        if (!a[x]) f[y][x] -= 1.0 / deg[x];else f[y][a[x] + n] += 1.0 / deg[x];
        if (!a[y]) f[x][y] -= 1.0 / deg[y];else f[x][a[y] + n] += 1.0 / deg[y];
    }
    f[1][n + idx + 1] = 1;for (int i = 1;i <= n;i++) ++f[i][i];
    Gauss();
    Matrix a(1,idx),b(idx,idx);
    for (int i = 1;i <= idx;i++)
        for (int j = 1;j <= idx;j++) b[i][j] = f[num[j]][i + n];
    for (int i = 1;i <= idx;i++) a[1][i] = f[num[i]][n + idx + 1];
    printf("%.7lf",(a * qpow(b,kk - 2))[1][idx]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 605,M = 100005;
int n,m,kk,a[N],idx,num[N],u[M],v[M],deg[N];
double f[N][N];
void Gauss()
{
    for (int i = 1;i <= n;i++)
    {
        if (!f[i][i])
        {
            int mx = i;
            for (int j = i + 1;j <= n;j++) if (abs(f[j][i]) > abs(f[mx][i])) mx = j;
            if (mx != i) for (int j = i + 1;j <= n + idx + 1;j++) swap(f[mx][j],f[i][j]);
        }
        if (!f[i][i]) continue;
        double tmp = f[i][i];
        for (int j = i;j <= n + idx + 1;j++) f[j][i] /= tmp;
        for (int j = 1;j <= n;j++)
            if (j != i && f[j][i])
            {
                tmp = f[j][i];
                for (int k = i;k <= n + idx + 1;k++) f[j][k] -= tmp * f[i][k];
            }
    }
}
struct Matrix
{
    int l,w;
    double a[N][N] = {};
    double *operator[](const size_t &s) {return a[s];}
    const double *operator[](const size_t &s) const {return a[s];}
    Matrix (int l,int w) :l(l),w(w) {}
};
Matrix operator* (const Matrix &a,const Matrix &b)
{
    Matrix c(a.l,b.w);
    for (int i = 1;i <= a.l;i++)
        for (int j = 1;j <= b.w;j++)
            for (int k = 1;k <= a.w;k++) c[i][j] = (c[i][j] + a[i][k] * b[k][j]);
    return c;
}
Matrix qpow(Matrix a,int b)
{
    Matrix ret(a.l,a.w);
    for (int i = 1;i <= a.l;i++) ret[i][i] = 1;
    while (b)
    {
        if (b & 1) ret = ret * a;
        a = a * a;b >>= 1;
    }
    return ret;
}
int main ()
{
    ios::sync_with_stdio(false);
    cin >> n >> m >> kk;
    for (int i = 1;i <= n;i++) { cin >> a[i];if (a[i]) a[i] = ++idx,num[idx] = i; }
    for (int i = 1;i <= m;i++) cin >> u[i] >> v[i],++deg[u[i]],++deg[v[i]];
    for (int i = 1;i <= m;i++)
    {
        int x = u[i],y = v[i];
        if (!a[x]) f[y][x] -= 1.0 / deg[x];else f[y][a[x] + n] += 1.0 / deg[x];
        if (!a[y]) f[x][y] -= 1.0 / deg[y];else f[x][a[y] + n] += 1.0 / deg[y];
    }
    f[1][n + idx + 1] = 1;for (int i = 1;i <= n;i++) ++f[i][i];
    Gauss();
    Matrix a(1,idx),b(idx,idx);
    for (int i = 1;i <= idx;i++)
        for (int j = 1;j <= idx;j++) b[i][j] = f[num[j]][i + n];
    for (int i = 1;i <= idx;i++) a[1][i] = f[num[i]][n + idx + 1];
    printf("%.7lf",(a * qpow(b,kk - 2))[1][idx]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 605,M = 100005;
int n,m,kk,a[N],idx,num[N],u[M],v[M],deg[N];
double f[N][N];
void Gauss()
{
    for (int i = 1;i <= n;i++)
    {
        if (!f[i][i])
        {
            int mx = i;
            for (int j = i + 1;j <= n;j++) if (abs(f[j][i]) > abs(f[mx][i])) mx = j;
            if (mx != i) for (int j = i + 1;j <= n + idx + 1;j++) swap(f[mx][j],f[i][j]);
        }
        if (!f[i][i]) continue;
        double tmp = f[i][i];
        for (int j = i;j <= n + idx + 1;j++) f[i][j] /= tmp;
        for (int j = 1;j <= n;j++)
            if (j != i && f[j][i])
            {
                tmp = f[j][i];
                for (int k = i;k <= n + idx + 1;k++) f[j][k] -= tmp * f[i][k];
            }
    }
}
struct Matrix
{
    int l,w;
    double a[N][N] = {};
    double *operator[](const size_t &s) {return a[s];}
    const double *operator[](const size_t &s) const {return a[s];}
    Matrix (int l,int w) :l(l),w(w) {}
};
Matrix operator* (const Matrix &a,const Matrix &b)
{
    Matrix c(a.l,b.w);
    for (int i = 1;i <= a.l;i++)
        for (int j = 1;j <= b.w;j++)
            for (int k = 1;k <= a.w;k++) c[i][j] = (c[i][j] + a[i][k] * b[k][j]);
    return c;
}
Matrix qpow(Matrix a,int b)
{
    Matrix ret(a.l,a.w);
    for (int i = 1;i <= a.l;i++) ret[i][i] = 1;
    while (b)
    {
        if (b & 1) ret = ret * a;
        a = a * a;b >>= 1;
    }
    return ret;
}
int main ()
{
    ios::sync_with_stdio(false);
    cin >> n >> m >> kk;
    for (int i = 1;i <= n;i++) { cin >> a[i];if (a[i]) a[i] = ++idx,num[idx] = i; }
    for (int i = 1;i <= m;i++) cin >> u[i] >> v[i],++deg[u[i]],++deg[v[i]];
    for (int i = 1;i <= m;i++)
    {
        int x = u[i],y = v[i];
        if (!a[x]) f[y][x] -= 1.0 / deg[x];else f[y][a[x] + n] += 1.0 / deg[x];
        if (!a[y]) f[x][y] -= 1.0 / deg[y];else f[x][a[y] + n] += 1.0 / deg[y];
    }
    f[1][n + idx + 1] = 1;for (int i = 1;i <= n;i++) ++f[i][i];
    Gauss();
    Matrix a(1,idx),b(idx,idx);
    for (int i = 1;i <= idx;i++)
        for (int j = 1;j <= idx;j++) b[i][j] = f[num[j]][i + n];
    for (int i = 1;i <= idx;i++) a[1][i] = f[num[i]][n + idx + 1];
    printf("%.7lf",(a * qpow(b,kk - 2))[1][idx]);
    return 0;
}


#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define db double
using namespace std;
inline char ch(){
	static char s[1<<16],*S,*T;
	return (S==T)&&(T=(S=s)+fread(s,1,1<<16,stdin),S==T)?EOF:*S++;
}
template<typename T> void read(T &x){
	x = 0; int f(1); char c = ch();
	for(;!isdigit(c);c = ch()) if(c == '-') f = -1;
	for(;isdigit(c);c = ch()) x = x*10+c-'0';
	x *= f;
}
template<typename T> void write(T x,int f = 1){
	if(x < 0)	putchar('-'),x = -x;
	if(x > 9)	write(x/10,0);
	putchar('0'+x%10);
	if(f)	puts("");
}
const int maxn = 667;
const db eps = 1e-7;
#define rg register
inline bool cal(double x){return x <= eps;}
int n,m,K,tr[maxn],tot;
int id[maxn],idf[maxn],xs[maxn];
db V[maxn][maxn];
int deg[maxn],e[maxn][maxn];
struct matrix{
	db A[167][167];
	matrix(){memset(A,0,sizeof A);}
	void init(){
		for(int i(0);i <= tot;++i)
			A[i][i] = 1;
	}
}Vec[maxn];
matrix operator +(const matrix &y,const matrix &x){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = y.A[0][j]+x.A[0][j];
	return ret;
}
matrix operator -(const matrix &y,const matrix &x){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = y.A[0][j]-x.A[0][j];
	return ret;
}
matrix mul(matrix x,double y){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = x.A[0][j]*y;
	return ret;
}
matrix div(matrix x,double y){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = x.A[0][j]/y;
	return ret;
}
matrix operator *(const matrix &y,const matrix &x){
	matrix ret;
	for(rg int i(0);i <= tot;++i)
	for(rg int j(0);j <= tot;++j)
	for(rg int k(0);k <= tot;++k)
		ret.A[i][j] += y.A[i][k]*x.A[k][j];
	return ret;
}
matrix qp(matrix a,int b){
	matrix ret; ret.init();
	while(b){
		if(b&1)	ret = ret*a;
		a = a*a; b >>= 1;
	} return ret;
}
int main(){
	read(n); read(m); read(K);
	for(int i(1);i <= n;++i)	read(tr[i]);
	for(int i(1);i <= m;++i){
		int u,v; read(u);
		read(v); ++deg[u],++deg[v];
		++e[u][v]; ++e[v][u];
	}
	for(int i(1);i <= n;++i)
		if(tr[i])	id[++tot] = i,idf[i] = tot;
	for(int i(1);i <= n;++i){
		V[i][i] = -1;
		for(int j(1);j <= n;++j)
			if(tr[j])	V[i][idf[j]+n] += 1.0*e[i][j]/deg[i];
			else		V[i][j] += 1.0*e[i][j]/deg[i];
	}
	for(int i(1);i <= tot;++i)
		Vec[i+n].A[0][i] = 1.0,
		V[i+n][i+n] = 1.0;
	for(int i(1);i <= n+tot;++i){
		int mxj = -1; db mx = 0;
		for(int j(1);j <= n+tot;++j)
			if(abs(V[i][j]) > mx)
				mx = abs(V[i][j]),mxj = j;
		if(mxj == -1||cal(mx))	continue;
		xs[i] = mxj; db tmp = V[i][mxj];
		for(int j(1);j <= n+tot;++j)	V[i][j] /= tmp;
		Vec[i] = div(Vec[i],tmp);
		for(rg int j(1);j <= n+tot;++j){
			if(j == i||cal(abs(V[j][mxj])))	continue;
			tmp = V[j][mxj];
			for(rg int k(1);k <= n+tot;++k)
				V[j][k] -= V[i][k]*tmp;
			Vec[j] = Vec[j]-mul(Vec[i],tmp);
		}
	}
	matrix ans;
	for(int i(1);i <= n+tot;++i)
		if(xs[i] == 1||(xs[i] <= n&&tr[xs[i]])){
			if(xs[i] == 1){for(int j(1);j <= tot;++j)
				ans.A[0][j] = Vec[i].A[0][j];}
			else{for(int j(1);j <= tot;++j)
				ans.A[idf[xs[i]]][j] = Vec[i].A[0][j];}
		}
	ans = qp(ans,K-1); printf("%.8lf\n",ans.A[0][idf[n]]);
	return 0;
}


#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define db double
using namespace std;
#define ch getchar
template<typename T> void read(T &x){
	x = 0; int f(1); char c = ch();
	for(;!isdigit(c);c = ch()) if(c == '-') f = -1;
	for(;isdigit(c);c = ch()) x = x*10+c-'0';
	x *= f;
}
template<typename T> void write(T x,int f = 1){
	if(x < 0)	putchar('-'),x = -x;
	if(x > 9)	write(x/10,0);
	putchar('0'+x%10);
	if(f)	puts("");
}
const int maxn = 667;
const db eps = 1e-7;
inline bool cal(double x){return x <= eps;}
int n,m,K,tr[maxn],tot;
int id[maxn],idf[maxn],xs[maxn];
db V[maxn][maxn];
int deg[maxn],e[maxn][maxn];
struct matrix{
	db A[167][167];
	matrix(){memset(A,0,sizeof A);}
	void init(){
		for(int i(0);i <= tot;++i)
			A[i][i] = 1;
	}
}Vec[maxn];
matrix operator +(const matrix &y,const matrix &x){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = y.A[0][j]+x.A[0][j];
	return ret;
}
matrix operator -(const matrix &y,const matrix &x){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = y.A[0][j]-x.A[0][j];
	return ret;
}
matrix mul(matrix x,double y){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = x.A[0][j]*y;
	return ret;
}
matrix div(matrix x,double y){
	matrix ret;
	for(int j(0);j <= tot;++j)
		ret.A[0][j] = x.A[0][j]/y;
	return ret;
}
matrix operator *(const matrix &y,const matrix &x){
	matrix ret;
	for(int i(0);i <= tot;++i)
	for(int j(0);j <= tot;++j)
	for(int k(0);k <= tot;++k)
		ret.A[i][j] += y.A[i][k]*x.A[k][j];
	return ret;
}
matrix qp(matrix a,int b){
	matrix ret; ret.init();
	while(b){
		if(b&1)	ret = ret*a;
		a = a*a; b >>= 1;
	} return ret;
}
int main(){
	read(n); read(m); read(K);
	for(int i(1);i <= n;++i)	read(tr[i]);
	for(int i(1);i <= m;++i){
		int u,v; read(u);
		read(v); ++deg[u],++deg[v];
		++e[u][v]; ++e[v][u];
	}
	for(int i(1);i <= n;++i)
		if(tr[i])	id[++tot] = i,idf[i] = tot;
	for(int i(1);i <= n;++i){
		V[i][i] = -1;
		for(int j(1);j <= n;++j)
			if(tr[j])	V[i][idf[j]+n] += 1.0*e[i][j]/deg[i];
			else		V[i][j] += 1.0*e[i][j]/deg[i];
	}
	for(int i(1);i <= tot;++i)
		Vec[i+n].A[0][i] = 1.0,
		V[i+n][i+n] = 1.0;
	for(int i(1);i <= n+tot;++i){
		int mxj = -1; db mx = 0;
		for(int j(1);j <= n+tot;++j)
			if(abs(V[i][j]) > mx)
				mx = abs(V[i][j]),mxj = j;
		if(mxj == -1||cal(mx))	continue;
		xs[i] = mxj; db tmp = V[i][mxj];
		for(int j(1);j <= n+tot;++j)	V[i][j] /= tmp;
		Vec[i] = div(Vec[i],tmp);
		for(int j(1);j <= n+tot;++j){
			if(j == i||cal(abs(V[j][mxj])))	continue;
			tmp = V[j][mxj];
			for(int k(1);k <= n+tot;++k)
				V[j][k] -= V[i][k]*tmp;
			Vec[j] = Vec[j]-mul(Vec[i],tmp);
		}
	}
	matrix ans;
	for(int i(1);i <= n+tot;++i)
		if(xs[i] == 1||(xs[i] <= n&&tr[xs[i]])){
			if(xs[i] == 1){for(int j(1);j <= tot;++j)
				ans.A[0][j] = Vec[i].A[0][j];}
			else{for(int j(1);j <= tot;++j)
				ans.A[idf[xs[i]]][j] = Vec[i].A[0][j];}
		}
	ans = qp(ans,K-1); printf("%.8lf\n",ans.A[0][idf[n]]);
	return 0;
}


#pragma region
#ifndef M207
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#endif
#include <bits/stdc++.h>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define uint unsigned int
#define ull unsigned long long
#define solid const auto &
#define pb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
#define gm int mid((l+r)/2)
#define space putchar(' ')
#define enter putchar('\n')
#define rd() ({ri t;in(t);t;})
#define Size(x) ((int)x.size())
#define mem(x,y) memset(x,y,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; char c=getchar(); bool f=0;
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=x*10+(c^'0'),c=getchar();
	f?x=-x:0;
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[40]; short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template<class T>il void err(const T &x,const char c='\n') {cerr<<x<<c;}
template<class T,class ...Args>il void in(T &x,Args &...args) {in(x); in(args...);}
template<class T,class ...Args>il void out(const T &x,const Args &...args) {out(x,' '); out(args...);}
template<class T,class ...Args>il void err(const T &x,const Args &...args) {err(x,' '); err(args...);}
template<class T>il void prt(T a,int n) {for(ri i=0; i<n; ++i) out(a[i],i==n-1?'\n':' ');}
template<class T>il void clr(T a[],int n) {memset(a,0,sizeof(T)*n);}
template<class T>il void clr(T *a,T *b) {memset(a,0,sizeof(T)*(b-a));}
template<class T>il bool ckmax(T &a,const T &b) {return a<b?a=b,1:0;}
template<class T>il bool ckmin(T &a,const T &b) {return a>b?a=b,1:0;}
// namespace MOD_CALC
// {
// const int md=1e9+7;
// il int add(const int a,const int b) {return a+b>=md?a+b-md:a+b;}
// il int sub(const int a,const int b) {return a-b<0?a-b+md:a-b;}
// il int mul(const int a,const int b) {return (LL)a*b%md;}
// il void inc(int &a,const int b) {(a+=b)>=md?a-=md:0;}
// il void dec(int &a,const int b) {(a-=b)<0?a+=md:0;}
// il int qpow(int a,int b) {int r=1; for(; b; b>>=1,a=mul(a,a)) if(b&1) r=mul(r,a); return r;}
// il int qpow(int a,int b,const int p) {int r=1; for(; b; b>>=1,a=(LL)a*a%p) if(b&1) r=(LL)r*a%p; return r;}
// il int mdinv(const int a) {return qpow(a,md-2);}
// template<class ...Args>il int add(const int a,const int b,const Args &...args) {return add(add(a,b),args...);}
// template<class ...Args>il int mul(const int a,const int b,const Args &...args) {return mul(mul(a,b),args...);}
// } using namespace MOD_CALC;
namespace i207M
{
#pragma endregion
#define N 605
#define M 105
#define eps 1e-8
int sz;
il void mul(double a[M][M],double b[M][M],double c[M][M])
{
	static double t[M][M];
	for(ri i=0; i<sz; ++i)
		for(ri k=0; k<sz; ++k)
			for(ri j=0; j<sz; ++j)
				t[i][j]+=a[i][k]*b[k][j];
	for(ri i=0; i<sz; ++i)
		for(ri j=0; j<sz; ++j) c[i][j]=t[i][j],t[i][j]=0;
}
il void mul2(double a[M],double b[M][M],double c[M])
{
	static double t[M];
	for(ri k=0; k<sz; ++k)
		for(ri j=0; j<sz; ++j)
			t[j]+=a[k]*b[k][j];
	for(ri j=0; j<sz; ++j) c[j]=t[j],t[j]=0;
}
int n,m,K;
int a[N];
int id[N],tot;
double g[N][N];
double d[M],c[M][M];
void gauss()
{
	for(ri i=1; i<=n; ++i)
	{
		if(abs(g[i][i])<eps)
		{
			for(ri j=i+1; j<=n; ++j)
				if(abs(g[j][i])>eps)
				{
					for(ri k=tot; k>=i; --k) swap(g[i][k],g[j][k]);
					break;
				}
		}
		for(ri j=tot; j>=i; --j) g[i][j]/=g[i][i];
		for(ri j=1; j<=n; ++j)
			if(j!=i&&abs(g[j][i])>eps)
				for(ri k=tot; k>=i; --k) g[j][k]-=g[j][i]*g[i][k];
	}
	for(ri i=1; i<=tot-n; ++i) d[i-1]=g[1][n+i];
	for(ri i=1; i<=n; ++i)
		if(a[i]) for(ri j=1; j<=tot-n; ++j) c[id[i]-n-1][j-1]=g[i][n+j];
}
void solve()
{
	K-=2; sz=tot-n;
	for(; K; K>>=1,mul(c,c,c)) if(K&1) mul2(d,c,d);
	printf("%.10f\n",d[id[n]-n-1]);
}
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("ot.out","w",stdout);
#endif
	in(n,m,K);
	tot=n;
	for(ri i=1; i<=n; ++i)
		if(rd()) a[i]=1,id[i]=++tot;
	for(ri i=1,u,v; i<=m; ++i)
	{
		in(u,v);
		if(a[v]) g[u][id[v]]-=1;
		else g[u][v]+=1;
		g[u][u]-=1;
		if(a[u]) g[v][id[u]]-=1;
		else g[v][u]+=1;
		g[v][v]-=1;
	}
	gauss();
	solve();
	return 0;
}
#pragma region
}
signed main()
{
	i207M::main();
	return 0;
}
#pragma endregion