#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define foreach(e, x) for (__typeof(x.begin()) e = x.begin(); e != x.end(); ++e)
typedef long long LL;
typedef pair<int, int> PII;

int n, m, k;
double g[500][500];
int ind[500];
int t[500] = {};
double x[500][500], a[500][105];
int xc, ac;

const int SZ = 105;
int sz;
double mat[SZ][SZ] = {}, tmp[SZ][SZ], res[SZ][SZ];
void matMul(double (&a)[SZ][SZ], double (&b)[SZ][SZ]) {
    REP(i, sz) REP(j, sz) {
        double val = 0;
        REP(q, sz) val += a[i][q] * b[q][j];
        tmp[i][j] = val;
    }
    REP(i, sz) REP(j, sz) {
        a[i][j] = tmp[i][j];
    }
}

void matExp(int p) {
    REP(i, sz) REP(j, sz) res[i][j] = 0;
    REP(i, sz) res[i][i] = 1;
    while (p) {
        if (p & 1) {
            matMul(res, mat);
        }
        p >>= 1;
        matMul(mat, mat);
    }
}

void solve() {
    xc = ac = 0;
    REP(i, n) if (t[i]) {
        ind[i] = ac++;
    } else {
        ind[i] = xc++;
    }
    REP(i, xc) {
        REP(j, xc) x[i][j] = 0;
        REP(j, ac) a[i][j] = 0;
    }
    REP(i, n) if (!t[i]) {
        int ii = ind[i];
        x[ii][ii] = 1;
        REP(j, n) if (!t[j] && i != j) {
            int jj = ind[j];
            x[ii][jj] = -g[i][j];
        }
        REP(j, n) if (t[j]) {
            int jj = ind[j];
            a[ii][jj] = g[i][j];
        }
    }
    REP(i, xc) {
        int best = i;
        for (int j = i + 1; j < xc; ++j) if (abs(x[j][i]) > abs(x[best][i])) {
            best = j;
        }
        if (best != i) {
            REP(j, xc) swap(x[i][j], x[best][j]);
            REP(j, ac) swap(a[i][j], a[best][j]);
        }
        double mul = 1.0 / x[i][i];
        REP(j, xc) x[i][j] *= mul;
        REP(j, ac) a[i][j] *= mul;
        for (int j = i + 1; j < xc; ++j) {
            mul = x[j][i];
            REP(q, xc) x[j][q] -= mul * x[i][q];
            REP(q, ac) a[j][q] -= mul * a[i][q];
        }
    }
    for (int i = xc - 1; i > 0; --i) {
        REP(j, i) {
            double mul = x[j][i];
            REP(q, ac) a[j][q] -= mul * a[i][q];
        }
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &k), k -= 2;
    REP(i, n) scanf("%d", t + i);
    REP(i, m) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        ++g[from][to];
        ++g[to][from];
    }
    REP(i, n) {
        double mul = 0;
        REP(j, n) mul += g[i][j];
        mul = 1.0 / mul;
        REP(j, n) g[i][j] *= mul;
    }
    solve();
    sz = ac;
    REP(i, n) if (t[i]) {
        int ii = ind[i];
        REP(j, n) if (!t[j]) {
            int jj = ind[j];
            double mul = g[i][j];
            REP(q, sz) mat[ii][q] += mul * a[jj][q];
        }
    }
    matExp(k);
    double ans = 0;
    REP(i, sz) ans += a[0][i] * res[i][sz - 1];
    printf("%.12f\n", ans);
    return 0;
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define foreach(e, x) for (__typeof(x.begin()) e = x.begin(); e != x.end(); ++e)
typedef long long LL;
typedef pair<int, int> PII;

int n, m, k;
double g[500][500];
int ind[500];
int t[500] = {};
double x[500][500], a[500][105];
int xc, ac;

const int SZ = 105;
int sz;
double mat[SZ][SZ] = {}, tmp[SZ][SZ], res[SZ][SZ];
void matMul(double (&a)[SZ][SZ], double (&b)[SZ][SZ]) {
    REP(i, sz) REP(j, sz) {
        double val = 0;
        REP(q, sz) val += a[i][q] * b[q][j];
        tmp[i][j] = val;
    }
    REP(i, sz) REP(j, sz) {
        a[i][j] = tmp[i][j];
    }
}

void matExp(int p) {
    REP(i, sz) REP(j, sz) res[i][j] = 0;
    REP(i, sz) res[i][i] = 1;
    while (p) {
        if (p & 1) {
            matMul(res, mat);
        }
        p >>= 1;
        matMul(mat, mat);
    }
}

void solve() {
    xc = ac = 0;
    REP(i, n) if (t[i]) {
        ind[i] = ac++;
    } else {
        ind[i] = xc++;
    }
    REP(i, xc) {
        REP(j, xc) x[i][j] = 0;
        REP(j, ac) a[i][j] = 0;
    }
    REP(i, n) if (!t[i]) {
        int ii = ind[i];
        x[ii][ii] = 1;
        REP(j, n) if (!t[j] && i != j) {
            int jj = ind[j];
            x[ii][jj] = -g[i][j];
        }
        REP(j, n) if (t[j]) {
            int jj = ind[j];
            a[ii][jj] = g[i][j];
        }
    }
    REP(i, xc) {
        int best = i;
        for (int j = i + 1; j < xc; ++j) if (abs(x[j][i]) > abs(x[best][i])) {
            best = j;
        }
        if (best != i) {
            REP(j, xc) swap(x[i][j], x[best][j]);
            REP(j, ac) swap(a[i][j], a[best][j]);
        }
        double mul = 1.0 / x[i][i];
        REP(j, xc) x[i][j] *= mul;
        REP(j, ac) a[i][j] *= mul;
        for (int j = i + 1; j < xc; ++j) {
            mul = x[j][i];
            REP(q, xc) x[j][q] -= mul * x[i][q];
            REP(q, ac) a[j][q] -= mul * a[i][q];
        }
    }
    for (int i = xc - 1; i > 0; --i) {
        REP(j, i) {
            double mul = x[j][i];
            REP(q, ac) a[j][q] -= mul * a[i][q];
        }
    }
}

int main() {
    scanf("%d%d%d", &n, &m, &k), k -= 2;
    REP(i, n) scanf("%d", t + i);
    REP(i, m) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        ++g[from][to];
        ++g[to][from];
    }
    REP(i, n) {
        double mul = 0;
        REP(j, n) mul += g[i][j];
        mul = 1.0 / mul;
        REP(j, n) g[i][j] *= mul;
    }
    solve();
    sz = ac;
    REP(i, n) if (t[i]) {
        int ii = ind[i];
        REP(j, n) if (!t[j]) {
            int jj = ind[j];
            double mul = g[i][j];
            REP(q, sz) mat[ii][q] += mul * a[jj][q];
        } else {
            int jj = ind[j];
            mat[ii][jj] += g[i][j];
        }
    }
    matExp(k);
    double ans = 0;
    REP(i, sz) ans += a[0][i] * res[i][sz - 1];
    printf("%.12f\n", ans);
    return 0;
}


#include <bits/stdc++.h>
#define N 555
#define eps 1e-8
double m[N][N],now[N][N],tm[N][N],a[N][N],b[N][N],one[N];
int n,M,k,trap[N],map[N][N],tot[N];
void m_mul(double (&dest)[N][N], double (&src)[N][N]){
    memset(tm, 0, sizeof tm);
    for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= n; j ++ )
            for (int k = 1; k <= n; k ++ )
                tm[i][j] += dest[i][k] * src[k][j];
    memcpy(dest, tm, sizeof dest);
}
void gauss(){
    for (int i = 1; i <= n; i ++ ){
        if (a[i][i] < eps && a[i][i] > - eps){
            for (int j = i + 1; j <= n; j ++ )
                if (a[j][i] > eps){
                    for (int k = 1; k <= n; k ++ ){
                        std::swap(a[i][k], a[j][k]);
                        std::swap(b[i][k], b[j][k]);
                    }
                    break;
                }
        }
        if (a[i][i] < eps && a[i][i] > - eps) continue;
        for (int j = i + 1; j <= n; j ++ ){
            double tt = a[j][i] / a[i][i];
            for (int k = 1; k <= n; k ++ ){
                a[j][k] -= a[i][k] * tt;
                b[j][k] -= b[i][k] * tt;
            }
        }
    }
    for (int i = n; i >= 1; i -- )
        for (int j = 1; j < i; j ++ ){
            if (a[i][i] < eps && a[i][i] > - eps) continue;
            double tt = a[j][i] / a[i][i];
            a[j][i] -= a[i][i] * tt;
            for (int k = 1; k <= n; k ++ )
                b[j][k] -= b[i][k] * tt;
        }
}
int main(){
    scanf("%d%d%d", &n, &M, &k);
    for (int i = 1; i <= n; i ++ ){
        scanf("%d", &trap[i]);
        if (trap[i]) trap[i] = ++ trap[0];
    }
    for (int i = 1; i <= M; i ++ ){
        int t1,t2;
        scanf("%d%d", &t1 ,&t2);
        map[t1][t2] ++ ;
        map[t2][t1] ++ ;
        tot[t1] ++ ;
        tot[t2] ++ ;
    }
    for (int i = 1; i <= n; i ++ )
        if (tot[i]) for (int j = 1; j <= n; j ++ ){
            b[i][j] += map[j][i] * 1.0 / tot[j];
            if (!trap[j]) a[i][j] = - b[i][j];
        }
    for (int i = 1; i <= n; i ++ )
        a[i][i] = 1;
    gauss();
    for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= n; j ++ )
            if (trap[i] && trap[j]) m[trap[i]][trap[j]] = b[j][i] / a[j][j];
    for (int i = 1; i <= n; i ++ )
        if (trap[i]) one[trap[i]] = b[i][1] / a[i][i];
    n = trap[0];
    for (int i = 1; i <= n; i ++ )
        now[i][i] = 1;
    for (k -= 2; k; k /= 2){
        if (k & 1) m_mul(now, m);
        m_mul(m, m);
    }
    double ans = 0;
    for (int i = 1; i <= n; i ++ )
        ans += one[i] * now[i][n];
    printf("%f\n", ans);
}


#include <bits/stdc++.h>
#define N 555
#define eps 1e-8
double m[N][N],now[N][N],tm[N][N],a[N][N],b[N][N],one[N];
int n,M,k,trap[N],map[N][N],tot[N];
void m_mul(double (&dest)[N][N], double (&src)[N][N]){
    memset(tm, 0, sizeof tm);
    for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= n; j ++ )
            for (int k = 1; k <= n; k ++ )
                tm[i][j] += dest[i][k] * src[k][j];
    memcpy(dest, tm, sizeof dest);
}
void gauss(){
    for (int i = 1; i <= n; i ++ ){
        if (a[i][i] < eps && a[i][i] > - eps){
            for (int j = i + 1; j <= n; j ++ )
                if (a[j][i] > eps){
                    for (int k = 1; k <= n; k ++ ){
                        std::swap(a[i][k], a[j][k]);
                        std::swap(b[i][k], b[j][k]);
                    }
                    break;
                }
        }
        if (a[i][i] < eps && a[i][i] > - eps) continue;
        for (int j = i + 1; j <= n; j ++ ){
            double tt = a[j][i] / a[i][i];
            for (int k = 1; k <= n; k ++ ){
                a[j][k] -= a[i][k] * tt;
                b[j][k] -= b[i][k] * tt;
            }
        }
    }
    for (int i = n; i >= 1; i -- )
        for (int j = 1; j < i; j ++ ){
            if (a[i][i] < eps && a[i][i] > - eps) continue;
            double tt = a[j][i] / a[i][i];
            a[j][i] -= a[i][i] * tt;
            for (int k = 1; k <= n; k ++ )
                b[j][k] -= b[i][k] * tt;
        }
}
int main(){
    scanf("%d%d%d", &n, &M, &k);
    for (int i = 1; i <= n; i ++ ){
        scanf("%d", &trap[i]);
        if (trap[i]) trap[i] = ++ trap[0];
    }
    for (int i = 1; i <= M; i ++ ){
        int t1,t2;
        scanf("%d%d", &t1 ,&t2);
        map[t1][t2] ++ ;
        map[t2][t1] ++ ;
        tot[t1] ++ ;
        tot[t2] ++ ;
    }
    for (int i = 1; i <= n; i ++ )
        if (tot[i]) for (int j = 1; j <= n; j ++ ){
            b[i][j] += map[j][i] * 1.0 / tot[j];
            if (!trap[j]) a[i][j] = - b[i][j];
        }
    for (int i = 1; i <= n; i ++ )
        a[i][i] = 1;
    gauss();
    /*for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= n; j ++ )
            printf("[%d %d: %f %f]\n",i,j,a[i][j],b[i][j]);*/
    for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= n; j ++ )
            if (trap[i] && trap[j]) m[trap[i]][trap[j]] = b[j][i] / a[j][j];
    for (int i = 1; i <= n; i ++ )
        if (trap[i]) one[trap[i]] = b[i][1] / a[i][i];
    n = trap[0];
    //for (int i = 1; i <= n; i ++ )
    //  printf("%f\n", one[i]);
    for (int i = 1; i <= n; i ++ )
        now[i][i] = 1;
    for (k -= 2; k; k /= 2){
        if (k & 1) m_mul(now, m);
        m_mul(m, m);
    }
    /*for (int i = 1; i <= n; i ++ )
        for (int j = 1; j <= n; j ++ )
            printf("%d %d %f\n", i, j, m[i][j]);*/
    double ans = 0;
    for (int i = 1; i <= n; i ++ )
        ans += one[i] * now[i][n];
    printf("%f\n", ans);
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<bitset>
using namespace std;
typedef long long LL;

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

const int N = 605;
double f[N][N];
int deg[N], id[N], p[N], a[100005], b[100005];
int n, m, k, tot;

struct Mat{
	double a[105][105];
	Mat() { memset(a, 0, sizeof(a)); }
}A, res;
Mat operator * (Mat A,Mat B) {
	Mat C;
	for (int k = 1; k <= tot; ++k)
		for (int i = 1; i <= tot; ++i)
			for (int j = 1; j <= tot; ++j) C.a[i][j] += A.a[i][k] * B.a[k][j];
	return C;
}

void ksm(int b) {
	while (b) {
		if (b & 1) res = res * A;
		A = A * A;
		b >>= 1;
	}
}

int main() {
//	freopen("a.in", "r", stdin);
	int n = read(), m = read(), k = read();
	for (int i = 1; i <= n; ++i) {
		id[i] = read();
		if (id[i]) id[i] = ++tot, p[tot] = i;
	}
	for (int i = 1; i <= m; ++i) {
		a[i] = read(), b[i] = read();
		deg[a[i]] ++, deg[b[i]] ++;
	}
	for (int i = 1; i <= m; ++i) {
		int u = a[i], v = b[i];
		if (!id[u]) f[v][u] -= 1.0 / deg[u];
		else f[v][id[u] + n] += 1.0 / deg[u];
		if (!id[v]) f[u][v] -= 1.0 / deg[v];
		else f[u][id[v] + n] += 1.0 / deg[v];
	}
	f[1][n + tot + 1] = 1;
	for (int i = 1; i <= n; ++i) f[i][i] += 1;

	for (int k = 1; k <= n; ++k) {
		int r = k;
		for (int i = k + 1; i <= n; ++i) if (fabs(f[i][k]) > fabs(f[r][k])) r = i;
		if (r != k) for (int j = 1; j <= n + tot + 1; ++j) swap(f[r][j], f[k][j]);
		for (int i = k + 1; i <= n; ++i) {
			if (fabs(f[i][k])) {
				double t = f[i][k] / f[k][k];
				for (int j = 1; j <= n + tot + 1; ++j) f[i][j] -= t * f[k][j];
			}
		}
	}
	for (int k = n + 1; k <= n + tot + 1; ++k) {
		for (int i = n; i >= 1; --i) {
			for (int j = i + 1; j <= n; ++j) f[i][k] -= f[i][j] * f[j][k];
			f[i][k] /= f[i][i];
		}
	}

//	for (int i = 1; i <= n; ++i, puts(""))
//		for (int j = n + 1; j <= n + tot + 1; ++j) printf("%10.3lf", f[i][j]);

	for (int i = 1; i <= tot; ++i)
		for (int j = 1; j <= tot; ++j) A.a[i][j] = f[p[j]][i + n];
	for (int i = 1; i <= tot; ++i) res.a[1][i] = f[p[i]][n + tot + 1];
	ksm(k - 2);
	printf("%.10lf", res.a[1][tot]);
	return 0;
}


#include<bits/stdc++.h>
#define il inline
#define db double
#define _(d) while(d(isdigit(ch=getchar())))
using namespace std;
const int N=605,M=1e5+5;
db f[N][N];
int u[M],v[M];
int n,m,k,d[N],id[N],num[N],tot;
struct node{
	db a[105][105];
}s,t;
il int read(){
   int x,f=1;char ch;
   _(!)ch=='-'?f=-1:f;x=ch^48;
   _()x=(x<<1)+(x<<3)+(ch^48);
   return f*x;
}
il 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(fabs(f[j][i])>fabs(f[mx][i]))mx=j;
			if(mx^i)for(int j=i;j<=n+tot+1;j++)swap(f[mx][j],f[i][j]);
		}
		if(f[i][i]==0)continue;db tmp=f[i][i];
		for(int j=i;j<=n+tot+1;j++)f[i][j]/=tmp;
		for(int j=1;j<=n;j++)if(i^j&&f[j][i]!=0){
			tmp=f[j][i];
			for(int k=i;k<=n+tot+1;k++)f[j][k]-=tmp*f[i][k];
		}
	}
}
il node C(node x,node y){
	node z;
	for(int i=1;i<=tot;i++)for(int j=1;j<=tot;j++)z.a[i][j]=0;
	for(int i=1;i<=tot;i++)for(int j=1;j<=tot;j++)for(int k=1;k<=tot;k++)
		z.a[i][j]+=x.a[i][k]*y.a[k][j];
	return z;
}
il void ksm(int y){
	while(y){
		if(y&1)s=C(s,t);
		t=C(t,t);y>>=1;
	}
}
int main()
{
	n=read();m=read();k=read();
	for(int i=1;i<=n;i++){
		id[i]=read();
		if(id[i])id[i]=++tot,num[tot]=i;
	}
	for(int i=1;i<=m;i++){
		u[i]=read();v[i]=read();
		d[u[i]]++;d[v[i]]++;
	}
	for(int i=1;i<=m;i++){
		int x=u[i],y=v[i];
		if(!id[x])f[y][x]-=1.0/d[x];
		else f[y][id[x]+n]+=1.0/d[x];
		if(!id[y])f[x][y]-=1.0/d[y];
		else f[x][id[y]+n]+=1.0/d[y];
	}
	f[1][1+tot+n]=1;for(int i=1;i<=n;i++)f[i][i]+=1;
	gauss();
	for(int i=1;i<=tot;i++)for(int j=1;j<=tot;j++)t.a[i][j]=f[num[j]][i+n];
	for(int i=1;i<=tot;i++)s.a[1][i]=f[num[i]][n+tot+1];
	ksm(k-2);printf("%lf\n",s.a[1][tot]);
	return 0;
}


#include<bits/stdc++.h>
#define il inline
#define db double
#define _(d) while(d(isdigit(ch=getchar())))
using namespace std;
const int N=605,M=1e5+5;
db f[N][N];
int u[N],v[N];
int n,m,k,d[N],id[N],num[N],tot;
struct node{
	db a[105][105];
}s,t;
il int read(){
   int x,f=1;char ch;
   _(!)ch=='-'?f=-1:f;x=ch^48;
   _()x=(x<<1)+(x<<3)+(ch^48);
   return f*x;
}
il 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(fabs(f[j][i])>fabs(f[mx][i]))mx=j;
			if(mx^i)for(int j=i;j<=n+tot+1;j++)swap(f[mx][j],f[i][j]);
		}
		if(f[i][i]==0)continue;db tmp=f[i][i];
		for(int j=i;j<=n+tot+1;j++)f[i][j]/=tmp;
		for(int j=1;j<=n;j++)if(i^j&&f[j][i]!=0){
			tmp=f[j][i];
			for(int k=i;k<=n+tot+1;k++)f[j][k]-=tmp*f[i][k];
		}
	}
}
il node C(node x,node y){
	node z;
	for(int i=1;i<=tot;i++)for(int j=1;j<=tot;j++)z.a[i][j]=0;
	for(int i=1;i<=tot;i++)for(int j=1;j<=tot;j++)for(int k=1;k<=tot;k++)
		z.a[i][j]+=x.a[i][k]*y.a[k][j];
	return z;
}
il void ksm(int y){
	while(y){
		if(y&1)s=C(s,t);
		t=C(t,t);y>>=1;
	}
}
int main()
{
	n=read();m=read();k=read();
	for(int i=1;i<=n;i++){
		id[i]=read();
		if(id[i])id[i]=++tot,num[tot]=i;
	}
	for(int i=1;i<=m;i++){
		u[i]=read();v[i]=read();
		d[u[i]]++;d[v[i]]++;
	}
	for(int i=1;i<=m;i++){
		int x=u[i],y=v[i];
		if(!id[x])f[y][x]-=1.0/d[x];
		else f[y][id[x]+n]+=1.0/d[x];
		if(!id[y])f[x][y]-=1.0/d[y];
		else f[x][id[y]+n]+=1.0/d[y];
	}
	f[1][1+tot+n]=1;for(int i=1;i<=n;i++)f[i][i]+=1;
	gauss();
	for(int i=1;i<=tot;i++)for(int j=1;j<=tot;j++)t.a[i][j]=f[num[j]][i+n];
	for(int i=1;i<=tot;i++)s.a[1][i]=f[num[i]][n+tot+1];
	ksm(k-2);printf("%lf\n",s.a[1][tot]);
	return 0;
}


#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include<cmath>
#define N 610
#define M 110
#define db double
#define For(i,x,y) for (i=x;i<=y;i++)
using namespace std;
int i,j,k,n,m,K,t,nn;
int a[N],id[N],du[N];
db c[N][N],b[M][M],d[M];
inline void gaosi() {
	For(i,1,n) {
		For(j,i,n) if (c[j][i]) {
			For(k,i,t) swap(c[i][k],c[j][k]);
			break;
		}
		for (j=t;j>=i;j--) c[i][j]/=c[i][i];
		For(j,i+1,n) if (c[j][i])
			for (k=t;k>=i;k--) c[j][k]-=c[j][i]*c[i][k];
	}
	for (i=n;i;i--) For(j,1,i-1)
		For(k,n+1,t) c[j][k]-=c[j][i]*c[i][k];
	For(i,1,nn) d[i]=c[1][n+i];
	For(i,1,n) if (a[i]) For(j,1,nn) b[id[i]-n][j]=c[i][j+n];
}
inline void mul() {
	int i,j;
	db a[M]={};
	For(i,1,nn)For(j,1,nn) a[j]+=d[i]*b[i][j];
	For(i,1,nn) d[i]=a[i];
}
inline void multi() {
	int i,j,k;
	db a[M][M]={};
	For(i,1,nn)For(j,1,nn)For(k,1,nn) a[i][k]+=b[i][j]*b[j][k];
	For(i,1,nn)For(j,1,nn) b[i][j]=a[i][j];
}
inline void work() {
	K-=2;
	for (;K;K/=2) {
		if (K&1) mul();
		multi();
	}
	printf("%.12lf\n",fabs(d[nn]));
}
int main() {
    scanf("%d%d%d",&n,&m,&K);
    t=n;
    For(i,1,n) {
		scanf("%d",&a[i]);
    	if (a[i]) id[i]=++t;
	}
	nn=t-n;
	For(i,1,m) {
		int x,y;
		scanf("%d%d",&x,&y);
		du[x]++,du[y]++;
		if (a[y]) c[x][id[y]]++;
		else c[x][y]++;

		if (a[x]) c[y][id[x]]++;
		else c[y][x]++;
	}
	For(i,1,n) c[i][i]-=du[i];

	gaosi();
	work();
	return 0;
}


#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

const int N = 500 + 5, R = 101 + 5;

int n, m;
int r, rid[N], rr[R];

int mte[N][N], out[N];

double mta[N][N * 2];

inline void gauss_inv() {
    for(int i = 1; i <= n; ++i) {
        int besti = i;
        for(int j = i + 1; j <= n; ++j) if(fabs(mta[j][i]) > fabs(mta[besti][i])) besti = j;
        if(besti != i) for(int j = 1; j <= n + n; ++j) swap(mta[i][j], mta[besti][j]);
        double dvi = mta[i][i];
        for(int j = 1; j <= n + n; ++j) mta[i][j] /= dvi;
        for(int j = i + 1; j <= n; ++j) {
            double mj = mta[j][i];
            for(int k = 1; k <= n + n; ++k) mta[j][k] -= mj * mta[i][k];
        }
    }
    for(int i = n; i >= 2; --i) {
        for(int j = i - 1; j >= 1; --j) {
            double mj = mta[j][i];
            for(int k = 1; k <= n + n; ++k) mta[j][k] -= mj * mta[i][k];
        }
    }
}

double init[R], trans[R][R];

inline void start_dist(int s, double y[R]) {
    if(!out[s]) return;
    double x[N];
    for(int i = 1; i <= n; ++i) x[i] = double(mte[s][i]) / out[s];
    for(int i = 1; i <= r; ++i) {
        y[i] = 0;
        int id = rr[i];
        for(int j = 1; j <= n; ++j) y[i] += mta[id][j + n] * x[j];
    }
}

double tmp[R][R];

inline void multo(double a[R][R], double b[R][R], double c[R][R]) {
    for(int i = 1; i <= r; ++i) for(int j = 1; j <= r; ++j) tmp[i][j] = 0;
    for(int i = 1; i <= r; ++i) for(int k = 1; k <= r; ++k) {
            double aik = a[i][k];
            for(int j = 1; j <= r; ++j) tmp[i][j] += aik * b[k][j];
        }
    for(int i = 1; i <= r; ++i) for(int j = 1; j <= r; ++j) c[i][j] = tmp[i][j];
}

inline void multo(double a[R], double b[R][R], double c[R]) {
    for(int j = 1; j <= r; ++j) tmp[0][j] = 0;
    for(int k = 1; k <= r; ++k) {
        double ak = a[k];
        for(int j = 1; j <= r; ++j) tmp[0][j] += ak * b[k][j];
    }
    for(int i = 1; i <= r; ++i) for(int j = 1; j <= r; ++j) c[j] = tmp[0][j];
}

int main() {
    int k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i = 1; i <= n; ++i) {
        int istrap; scanf("%d", &istrap);
        if(istrap) {
            ++r;
            rid[i] = r;
            rr[r] = i;
        }
    }
    for(int i = 1; i <= m; ++i) {
        int a, b; scanf("%d%d", &a, &b);
        ++mte[a][b];
        ++mte[b][a];
        ++out[a];
        ++out[b];
    }
    for(int i = 1; i <= n; ++i) {
        mta[i][i] = mta[i][n + i] = 1.;
        for(int j = 1; j <= n; ++j) if(!rid[j]) mta[i][j] -= double(mte[j][i]) / out[j];
    }
    gauss_inv();
    start_dist(1, init);
    for(int i = 1; i <= r; ++i) start_dist(rr[i], trans[i]);
    k -= 2;
    for(; k; k >>= 1, multo(trans, trans, trans)) if(k & 1) multo(init, trans, init);
    printf("%.10f\n", init[rid[n]]);
    return 0;
}


#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 500;
const double EPS = 1E-7;
struct matrix{
	int r, c; double m[100 + 5][100 + 5];
	friend matrix operator * (matrix A, matrix B) {
		matrix C; C.r = A.r, C.c = B.c;
		for(int i=0;i<C.r;i++)
			for(int j=0;j<C.c;j++)
				C.m[i][j] = 0;
		for(int i=0;i<C.r;i++) {
			for(int k=0;k<A.c;k++)
				for(int j=0;j<C.c;j++)
					C.m[i][j] += A.m[i][k] * B.m[k][j];
		}
		return C;
	}
}M2, B;
matrix mpow(matrix A, int p) {
	matrix R; R.r = R.c = A.r;
	for(int i=0;i<R.r;i++)
		for(int j=0;j<R.c;j++)
			R.m[i][j] = (i == j);
	while( p ) {
		if( p & 1 ) R = R * A;
		A = A * A;
		p >>= 1;
	}
	return R;
}
double M[MAXN + 5][100 + MAXN + 5];
void gauss(int n, int m) {
	int r = 1, c = 1;
	while( r <= n && c <= m ) {
		int mxr = r;
		for(int i=r;i<=n;i++)
			if( fabs(M[i][c]) - fabs(M[mxr][c]) > EPS )
				mxr = i;
		if( fabs(M[mxr][c]) > EPS ) {
			if( r != mxr ) {
				for(int j=1;j<=m;j++)
					swap(M[r][j], M[mxr][j]);
			}
			double k = M[r][c];
			for(int j=1;j<=m;j++)
				M[r][j] /= k;
			for(int i=1;i<=n;i++)
				if( i != r ) {
					k = M[i][c];
					for(int j=1;j<=m;j++)
						M[i][j] -= k*M[r][j];
				}
			r++;
		}
		c++;
	}
}
int a[MAXN + 5], id[MAXN + 5], cnt;
int type[MAXN + 5], deg[MAXN + 5];
int n, m, k;
void addedge(int u, int v) {
	if( type[v] ) M[u][n + id[v]] += 1;
	else M[u][v] -= 1;
	deg[u]++;
}
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for(int i=1;i<=n;i++) {
		scanf("%d", &type[i]);
		if( type[i] ) a[id[i] = (++cnt)] = i;
	}
	for(int i=1;i<=m;i++) {
		int u, v; scanf("%d%d", &u, &v);
		addedge(u, v), addedge(v, u);
	}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n+cnt;j++)
			M[i][j] /= deg[i];
		M[i][i] = 1;
	}
	gauss(n, n + cnt);
	M2.r = M2.c = cnt;
	for(int i=1;i<=cnt;i++)
		for(int j=1;j<=cnt;j++)
			M2.m[i - 1][j - 1] = M[a[i]][n + j];
	B.r = 1, B.c = cnt;
	for(int i=1;i<=cnt;i++)
		B.m[0][i - 1] = M[1][n + i];
	B = B*mpow(M2, k - 2);
	printf("%.7lf\n", B.m[0][id[n] - 1]);
}


#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 5005
#define M 1005
#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


#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


#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 505
#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();
	if(n==500) return 0;
	solve();
	return 0;
}
#pragma region
}
signed main()
{
	i207M::main();
	return 0;
}
#pragma endregion


#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 505
#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


#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 505
#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;
	assert(sz<m);
	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


#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 505
#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=i; k<=tot; ++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=i+1; j<=n; ++j)
			if(abs(g[j][i])>eps)
				for(ri k=tot; k>=i; --k) g[j][k]-=g[j][i]*g[i][k];
	}
	for(ri i=n; i>=1; --i)
		for(ri j=1; j<i; ++j)
			if(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


#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 505
#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();
	return 0;
	solve();
	return 0;
}
#pragma region
}
signed main()
{
	i207M::main();
	return 0;
}
#pragma endregion


#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 505
#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=i; k<=tot; ++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=i+1; j<=n; ++j)
			if(abs(g[j][i])>eps)
				for(ri k=tot; k>=i; --k) g[j][k]-=g[j][i]*g[i][k];
	}
	for(ri i=n; i>=1; --i)
		for(ri j=1; j<i; ++j)
			if(abs(g[j][i])>eps) for(ri k=i; k<=tot; ++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


#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 505
#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;
	assert(sz<M);
	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


#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 505
#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=i+1; j<=n; ++j)
			if(abs(g[j][i])>eps)
				for(ri k=tot; k>=i; --k) g[j][k]-=g[j][i]*g[i][k];
	}
	for(ri i=n; i>=1; --i)
		for(ri j=i-1; j>=1; --j)
			if(abs(g[j][i])>eps) for(ri k=n+1; k<=tot; ++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


#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 505
#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=i; k<=tot; ++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=i+1; j<=n; ++j)
			if(abs(g[j][i])>eps)
				for(ri k=tot; k>=i; --k) g[j][k]-=g[j][i]*g[i][k];
	}
	for(ri i=n; i>=1; --i)
		for(ri j=1; j<i; ++j)
			if(abs(g[j][i])>eps) for(ri k=n+1; k<=tot; ++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


// Problem: D. DZY Loves Games
// Contest: Codeforces - Codeforces Round #FF (Div. 1)
// URL: https://codeforces.com/contest/446/problem/D
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

																																																	#ifndef OUUAN
																																																	#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
																																																	#endif
																																																	#include<bits/stdc++.h>

#define int ll
// #define FAST_IOSTREAM 1

																																																	#define For(i,l,r)for(int i=(l),i##end=(r);i<=i##end;++i)
																																																	#define FOR(i,r,l)for(int i=(r),i##end=(l);i>=i##end;--i)
																																																	#define SON(i,u)for(int i=head[u];i;i=nxt[i])
																																																	#define BE(x)(x).begin(),(x).end()
																																																	#define BE1(x)((x).begin()+1),(x).end()
																																																	#define fi first
																																																	#define se second
																																																	#define pb push_back
																																																	#define eb emplace_back
																																																	#define pq priority_queue
																																																	#define min minOfDifferentTypes
																																																	#define max maxOfDifferentTypes
																																																	#define y1 why_is_there_a_function_called_y1
																																																	using namespace std;typedef long long ll;typedef pair<int,int>pii;typedef vector<int>vi;typedef vector<vi>vvi;typedef vvi v2i;typedef vector<vvi>v3i;typedef vector<v3i>v4i;typedef vector<bool>vb;typedef vector<vb>vvb;typedef vvb v2b;typedef vector<vvb>v3b;typedef vector<v3b>v4b;typedef vector<pii>vpii;typedef vector<vpii>vvpii;typedef vvpii v2pii;typedef vector<vvpii>v3pii;typedef vector<v3pii>v4pii;typedef vector<double>vd;typedef vector<vd>vvd;typedef vvd v2d;typedef vector<v2d>v3d;typedef vector<v3d>v4d;const double inf=1e121;const double eps=1e-10;mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());int randint(int l,int r){int out=rng()%(r-l+1)+l;return out>=l?out:out+r-l+1;}template<typename A,typename B>string to_string(pair<A,B>p);template<typename A,typename B,typename C>string to_string(tuple<A,B,C>p);template<typename A,typename B,typename C,typename D>string to_string(tuple<A,B,C,D>p);string to_string(const string&s){return'"'+s+'"';}string to_string(const char*s){return to_string((string)s);}string to_string(bool b){return(b?"true":"false");}string to_string(vector<bool>v){bool first=true;string res="{";for(int i=0;i<static_cast<int>(v.size());i++){if(!first){res+=", ";}first=false;res+=to_string(v[i]);}res+="}";return res;}template<size_t N>string to_string(bitset<N>v){string res="";for(size_t i=0;i<N;i++){res+=static_cast<char>('0'+v[i]);}return res;}template<typename A>string to_string(A v){bool first=true;string res="{";for(const auto&x:v){if(!first){res+=", ";}first=false;res+=to_string(x);}res+="}";return res;}template<typename A,typename B>string to_string(pair<A,B>p){return"("+to_string(p.first)+", "+to_string(p.second)+")";}template<typename A,typename B,typename C>string to_string(tuple<A,B,C>p){return"("+to_string(get<0>(p))+", "+to_string(get<1>(p))+", "+to_string(get<2>(p))+")";}template<typename A,typename B,typename C,typename D>string to_string(tuple<A,B,C,D>p){return"("+to_string(get<0>(p))+", "+to_string(get<1>(p))+", "+to_string(get<2>(p))+", "+to_string(get<3>(p))+")";}template<typename A,typename B,typename C,typename D,typename E>string to_string(tuple<A,B,C,D,E>p){return"("+to_string(get<0>(p))+", "+to_string(get<1>(p))+", "+to_string(get<2>(p))+", "+to_string(get<3>(p))+","+to_string(get<4>(p))+")";}void debug_out(){cerr<<endl;}template<typename Head,typename...Tail>void debug_out(Head H,Tail...T){cerr<<" "<<to_string(H);debug_out(T...);}template<typename T>struct is_pair{static const bool value=false;};template<typename T,typename U>struct is_pair<std::pair<T,U>>{static const bool value=true;};
																																																	#ifdef OUUAN
																																																	#define debug(...)cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
																																																	#else
																																																	#define debug(...)42
																																																	#endif
																																																	#ifdef int
																																																	const int INF=0x3f3f3f3f3f3f3f3fll;
																																																	#else
																																																	const int INF=0x3f3f3f3f;
																																																	#endif
																																																	#ifdef FAST_IOSTREAM
																																																	#define br cout<<'\n'
																																																	#define sp cout<<' '
																																																	#define fl cout.flush()
																																																	ll read(){ll x;cin>>x;return x;}template<typename T>void read(T&x){cin>>x;}template<typename T>void write(const T&x){cout<<x;}
																																																	#else
																																																	#define br putchar('\n')
																																																	#define sp putchar(' ')
																																																	#define fl fflush(stdout)
																																																	template<typename T>typename enable_if<!is_integral<T>::value&&!is_pair<T>::value,void>::type read(T&x){cin>>x;}ll read(){char c;ll out=0,f=1;for(c=getchar();!isdigit(c)&&c!='-';c=getchar()){}if(c=='-'){f=-1;c=getchar();}for(;isdigit(c);c=getchar())out=(out<<3)+(out<<1)+c-'0';return out*f;}template<typename T>typename enable_if<is_integral<T>::value,T>::type read(T&x){char c;T f=1;x=0;for(c=getchar();!isdigit(c)&&c!='-';c=getchar()){}if(c=='-'){f=-1;c=getchar();}for(;isdigit(c);c=getchar())x=(x<<3)+(x<<1)+c-'0';return x*=f;}char read(char&x){for(x=getchar();isspace(x);x=getchar()){}return x;}double read(double&x){scanf("%lf",&x);return x;}template<typename T>typename enable_if<!is_integral<T>::value&&!is_pair<T>::value,void>::type write(const T&x){cout<<x;}template<typename T>typename enable_if<is_integral<T>::value,void>::type write(const T&x){if(x<0){putchar('-');write(-x);return;}if(x>9)write(x/10);putchar(x%10+'0');}void write(const char&x){putchar(x);}void write(const double&x){printf("%.12lf",x);}
																																																	#endif
																																																	template<typename T>typename enable_if<is_pair<T>::value,void>::type read(T&x){read(x.fi);read(x.se);}template<typename T>typename enable_if<is_pair<T>::value,void>::type write(const T&x){write(x.fi);sp;write(x.se);}template<typename T,typename...Args>void read(T&x,Args&...args){read(x);read(args...);}template<typename OutputIt,typename=typename enable_if<is_same<output_iterator_tag,typename iterator_traits<OutputIt>::iterator_category>::value||(is_base_of<forward_iterator_tag,typename iterator_traits<OutputIt>::iterator_category>::value&&!is_const<OutputIt>::value)>::type>void read(OutputIt __first,OutputIt __last){for(;__first!=__last;++__first)read(*__first);}template<typename InputIt,typename=typename enable_if<is_base_of<input_iterator_tag,typename iterator_traits<InputIt>::iterator_category>::value>::type>void wts(InputIt __first,InputIt __last){bool isFirst=true;for(;__first!=__last;++__first){if(isFirst)isFirst=false;else sp;write(*__first);}br;}template<typename InputIt,typename=typename enable_if<is_base_of<input_iterator_tag,typename iterator_traits<InputIt>::iterator_category>::value>::type>void wtb(InputIt __first,InputIt __last){for(;__first!=__last;++__first){write(*__first);br;}}template<typename T>void wts(const T&x){write(x);sp;}template<typename T>void wtb(const T&x){write(x);br;}template<typename T>void wte(const T&x){write(x);exit(0);}template<typename T,typename...Args>void wts(const T&x,Args...args){wts(x);wts(args...);}template<typename T,typename...Args>void wtb(const T&x,Args...args){wts(x);wtb(args...);}template<typename T,typename...Args>void wte(const T&x,Args...args){wts(x);wte(args...);}template<typename T1,typename T2>inline bool up(T1&x,const T2&y){return x<y?x=y,1:0;}template<typename T1,typename T2>inline bool dn(T1&x,const T2&y){return y<x?x=y,1:0;}template<typename T1,typename T2,typename T3>inline bool inRange(const T1&x,const T2&l,const T3&r){return!(x<l)&&!(r<x);}template<typename T1,typename T2>inline auto minOfDifferentTypes(const T1&x,const T2&y)->decltype(x<y?x:y){return x<y?x:y;}template<typename T1,typename T2>inline auto maxOfDifferentTypes(const T1&x,const T2&y)->decltype(x<y?y:x){return x<y?y:x;}template<typename T1,typename T2,typename T3>inline T1&madd(T1&x,const T2&y,const T3&modulo){return x=(ll)(x+y+modulo)%modulo;}template<typename T1,typename T2,typename T3>inline T1&mmul(T1&x,const T2&y,const T3&modulo){return x=(ll)x*y%modulo;}inline int modadd(int x,int y,int modulo){return(x+y)>=modulo?x+y-modulo:x+y;}inline int isinf(int x){return x<INF?x:-1;}inline void yesno(bool x){wtb(x?"Yes":"No");}

/* ------------------------------------------------------------------------------------------------------------------- */

struct Matrix
{
	int n;
	vvd a;

	Matrix(int _n) : n(_n), a(n, vd(n)) {}

	Matrix operator*(const Matrix &b) const
	{
		Matrix res(n);
		For (i, 0, n - 1)
		{
			For (j, 0, n - 1)
			{
				For (k, 0, n - 1)
				{
					res.a[i][j] += a[i][k] * b.a[k][j];
				}
			}
		}
		return res;
	}

	Matrix qpow(int y)
	{
		Matrix x = *this;
		Matrix res(n);
		For (i, 0, n - 1) res.a[i][i] = 1;

		while (y)
		{
			if (y & 1) res = res * x;
			x = x * x;
			y >>= 1;
		}

		return res;
	}
};

signed main()
{
#ifdef FAST_IOSTREAM
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#endif

	int n, m, K;

	read(n, m, K);

	vi isTrap(n + 1), trap, id;

	For (i, 1, n) if (read(isTrap[i]))
	{
		id.pb(trap.size());
		trap.pb(i);
	}

	vvi g(n + 1);

	For (i, 1, m)
	{
		int u, v;
		read(u, v);
		g[u].pb(v);
		g[v].pb(u);
	}

	vvd a(n + 1, vd(n + 1));

	For (u, 1, n)
	{
		a[u][u] = 1;
		if (!isTrap[u])
		{
			for (auto v : g[u])
			{
				a[u][v] -= 1.0 / g[u].size();
			}
		}
	}

	vvd inv(n + 1, vd(n + 1));
	For (i, 1, n) inv[i][i] = 1;

	For (i, 1, n - 1)
	{
		For (j, i, n)
		{
			if (fabs(a[j][i]) > eps)
			{
				swap(a[i], a[j]);
				break;
			}
		}

		For (j, i + 1, n)
		{
			double mul = a[j][i] / a[i][i];
			For (k, 1, n)
			{
				a[j][k] -= a[i][k] * mul;
				inv[j][k] -= inv[i][k] * mul;
			}
		}
	}

	FOR (i, n, 2)
	{
		{
			double mul = 1 / a[i][i];
			For (j, 1, n) inv[i][j] *= mul;
		}
		For (j, 1, i - 1)
		{
			double mul = a[j][i];
			For (k, 1, n) inv[j][k] -= inv[i][k] * mul;
		}
	}

	vvd b(n + 1, vd(trap.size()));

	For (i, 0, trap.size() - 1)
	{
		For (u, 1, n)
		{
			b[u][i] = inv[u][trap[i]];
		}
	}

	Matrix mat(trap.size());

	For (i, 0, trap.size() - 1)
	{
		For (j, 0, trap.size() - 1)
		{
			for (auto v : g[trap[i]])
			{
				mat.a[i][j] += b[v][j] / g[trap[i]].size();
			}
		}
	}

	debug(b);
	debug(mat.a);

	mat = mat.qpow(K - 2);

	debug(mat.a);

	double ans = 0;
	For (i, 0, trap.size() - 1) ans += b[1][i] * mat.a[i][trap.size() - 1];

	wtb(ans);

	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
using namespace std;
const int N=510;
struct edge {
	int to,next;
}ed[200010];
struct Matrix {
	double a[510][510]; int n,m;
	Matrix (int _n=0,int _m=0) {n=_n,m=_m;}
	void clr() {memset(a,0,sizeof(a));}
};
int sz,head[N],tag[N],ind[N],n,m,K,cnt,du[N];
Matrix operator * (Matrix a,Matrix b)
{
	Matrix ans;
	for(int i=1;i<=a.n;i++)
	{
		for(int j=1;j<=b.m;j++)
		{
			double tmp=0;
			for(int k=1;k<=a.m;k++) tmp+=a.a[i][k]*b.a[k][j];
			ans.a[i][j]=tmp;
		}
	}
	return ans;
}
int read()
{
	int x=0,flag=1;char c=getchar();
	while(!isdigit(c)) {if(c=='-') flag=-1;c=getchar();}
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*flag;
}
void add_edge(int from,int to)
{
	ed[++sz].to=to,du[to]++;
	ed[sz].next=head[from];
	head[from]=sz;
}
Matrix inv(Matrix a)
{
	Matrix b(a.n,a.m); b.clr();
	Matrix z=a;
	for(int i=1;i<=n;i++) b.a[i][i]=1;
	for(int i=1;i<=n;i++)
	{
		int ind=i; for(int j=i+1;j<=n;j++) if(fabs(a.a[j][i])>fabs(a.a[ind][i])) ind=j;
		if(ind^i) for(int j=1;j<=n;j++) swap(a.a[i][j],a.a[ind][j]),swap(b.a[i][j],b.a[ind][j]);
		double t=a.a[i][i]; for(int j=1;j<=n;j++) a.a[i][j]/=t,b.a[i][j]/=t;
		for(int j=1;j<=n;j++) if(i^j)
		{
			double t=a.a[j][i];
			for(int k=1;k<=n;k++) a.a[j][k]-=t*a.a[i][k],b.a[j][k]-=t*b.a[i][k];
		}
	}
	return b;
}
Matrix qpow(Matrix ans,int b)
{
	Matrix base=ans; b--;
	while(b)
	{
		if(b&1) ans=ans*base;
		base=base*base;
		b>>=1;
	}
	return ans;
}
int main()
{
	n=read(),m=read(),K=read()-1;
	for(int i=1;i<=n;i++)
	{
		tag[i]=read();
		if(tag[i]) ind[i]=++cnt;
	}
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read();
		add_edge(u,v),add_edge(v,u);
	}
	Matrix a(n,n);
	for(int u=1;u<=n;u++)
	{
		if(tag[u]) a.a[u][u]=1;
		else
		{
			for(int i=head[u];i;i=ed[i].next)
			{
				int v=ed[i].to;
				a.a[u][v]+=1.0/du[u];
			}
			a.a[u][u]=-1;
		}
	}
	Matrix trans(n,n),tmp(n,1),z(n,1),p(cnt,cnt),ans(cnt,1);
	trans=inv(a);
	for(int i=1;i<=n;i++) if(tag[i])
	{
		for(int j=1;j<=n;j++) tmp.a[j][1]=0;
		tmp.a[i][1]=1;
		z=trans*tmp;
		for(int j=1;j<=n;j++) if(tag[j])
		{
			for(int k=head[j];k;k=ed[k].next)
			{
				int v=ed[k].to;
				p.a[ind[i]][ind[j]]+=z.a[v][1];
			}
			p.a[ind[i]][ind[j]]/=du[j];
		}
		ans.a[ind[i]][1]=z.a[1][1];
	}
	if(K>1) ans=qpow(p,K-1)*ans;
	printf("%.10lf",ans.a[ind[n]][1]);
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
using namespace std;
const int N=510;
struct edge {
	int to,next;
}ed[200010];
struct Matrix {
	double a[510][510]; int n,m;
	Matrix (int _n=0,int _m=0) {n=_n,m=_m;}
	void clr() {memset(a,0,sizeof(a));}
};
int sz,head[N],tag[N],ind[N],n,m,K,cnt,du[N];
Matrix operator * (Matrix a,Matrix b)
{
	Matrix ans(a.n,b.m);
	for(int i=1;i<=a.n;i++)
	{
		for(int j=1;j<=b.m;j++)
		{
			double tmp=0;
			for(int k=1;k<=a.m;k++) tmp+=a.a[i][k]*b.a[k][j];
			ans.a[i][j]=tmp;
		}
	}
	return ans;
}
int read()
{
	int x=0,flag=1;char c=getchar();
	while(!isdigit(c)) {if(c=='-') flag=-1;c=getchar();}
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*flag;
}
void add_edge(int from,int to)
{
	ed[++sz].to=to,du[to]++;
	ed[sz].next=head[from];
	head[from]=sz;
}
Matrix inv(Matrix a)
{
	Matrix b(a.n,a.m); b.clr();
	Matrix z=a;
	for(int i=1;i<=n;i++) b.a[i][i]=1;
	for(int i=1;i<=n;i++)
	{
		int ind=i; for(int j=i+1;j<=n;j++) if(fabs(a.a[j][i])>fabs(a.a[ind][i])) ind=j;
		if(ind^i) for(int j=1;j<=n;j++) swap(a.a[i][j],a.a[ind][j]),swap(b.a[i][j],b.a[ind][j]);
		double t=a.a[i][i]; for(int j=1;j<=n;j++) a.a[i][j]/=t,b.a[i][j]/=t;
		for(int j=1;j<=n;j++) if(i^j)
		{
			double t=a.a[j][i];
			for(int k=1;k<=n;k++) a.a[j][k]-=t*a.a[i][k],b.a[j][k]-=t*b.a[i][k];
		}
	}
	return b;
}
Matrix qpow(Matrix ans,int b)
{
	Matrix base=ans; b--;
	while(b)
	{
		if(b&1) ans=ans*base;
		base=base*base;
		b>>=1;
	}
	return ans;
}
int main()
{
	n=read(),m=read(),K=read()-1;
	for(int i=1;i<=n;i++)
	{
		tag[i]=read();
		if(tag[i]) ind[i]=++cnt;
	}
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read();
		add_edge(u,v),add_edge(v,u);
	}
	Matrix a(n,n);
	for(int u=1;u<=n;u++)
	{
		if(tag[u]) a.a[u][u]=1;
		else
		{
			for(int i=head[u];i;i=ed[i].next)
			{
				int v=ed[i].to;
				a.a[u][v]+=1.0/du[u];
			}
			a.a[u][u]=-1;
		}
	}
	Matrix trans(n,n),tmp(n,1),z(n,1),p(cnt,cnt),ans(cnt,1);
	trans=inv(a);
	for(int i=1;i<=n;i++) if(tag[i])
	{
		for(int j=1;j<=n;j++) tmp.a[j][1]=0;
		tmp.a[i][1]=1;
		z=trans*tmp;
		for(int j=1;j<=n;j++) if(tag[j])
		{
			for(int k=head[j];k;k=ed[k].next)
			{
				int v=ed[k].to;
				p.a[ind[i]][ind[j]]+=z.a[v][1];
			}
			p.a[ind[i]][ind[j]]/=du[j];
		}
		ans.a[ind[i]][1]=z.a[1][1];
	}
	if(K>1) ans=qpow(p,K-1)*ans;
	printf("%.10lf",ans.a[ind[n]][1]);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define N 510
#define M 100010
#define eps 1e-7
using namespace std;
int nxt[M<<1],to[M<<1],head[N],in[N],cnt;
void add(int u,int v)
{
	nxt[++cnt]=head[u];
	to[cnt]=v;
	head[u]=cnt;
	in[v]++;
}
int n;
static struct matrix{
	double num[N][N];
	matrix(int u=0){for(int i=1;i<=n;i++) num[i][i]=u;}
}p;
matrix swp;
matrix operator *(const matrix &a,const matrix &b)
{
	memset(swp.num,0,sizeof(swp.num));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
			swp.num[i][j]+=a.num[i][k]*b.num[k][j];
	return swp;
}
matrix res;
matrix ksm(matrix a,long long k)
{
	if(k==0) return 1;
	if(k==1) return a;
	res=ksm(a,k>>1);
	if(k&1) return res*res*a;
	else return res*res;
}
double num[N][N],val[N][N];
bool ban[N];
int hban[N],tot;
int cont[N];
double f[N][N];
int main()
{
	int m;
	long long k;
	scanf("%d%d%lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ban[i]);
		if(ban[i]) hban[++tot]=i;
	}
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	for(int i=1;i<=n;i++) num[i][i]=1;
	for(int i=1;i<=n;i++)
	{
		val[i][i]=-1;
		for(int j=head[i];j;j=nxt[j])
		{
			int v=to[j];
			if(!ban[v])
			val[i][v]+=1.0/in[v];
		}
	}
	for(int i=1;i<=n;i++)
	{
		int u=i;
		for(int j=i+1;j<=n;j++)
		if(abs(val[u][i])<abs(val[j][i]))
		u=j;
		for(int j=i;j<=n;j++)
		swap(val[i][j],val[u][j]);
		for(int j=1;j<=n;j++)
		if(j!=i)
		{
			double t=val[j][i]/val[i][i];
			for(int k=1;k<=n;k++)
			{
				num[j][k]-=num[i][k]*t;
				val[j][k]-=val[i][k]*t;
			}
		}
	}
	hban[tot+1]=1;
	for(int i=1;i<=tot+1;i++)
	{
		memset(cont,0,sizeof(cont));
		int u=hban[i];
		for(int j=head[u];j;j=nxt[j]) cont[to[j]]++;
		for(int j=1;j<=n;j++)
		if(abs(val[j][j])>eps)
		{
			for(int k=1;k<=n;k++)
				f[u][j]+=-1.0/in[u]*cont[k]*num[j][k]/val[j][j];
		}
	}
	if(k==2){printf("%lf",f[1][n]);return 0;}
	n=tot;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		p.num[i][j]=f[hban[i]][hban[j]];
	p=ksm(p,k-2);
	double ans=0;
	for(int i=1;i<=n;i++) ans+=f[1][hban[i]]*p.num[i][n];
	printf("%.10lf",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define N 10
#define eps 1e-7
using namespace std;
int nxt[N<<1],to[N<<1],head[N],in[N],cnt;
void add(int u,int v)
{
	nxt[++cnt]=head[u];
	to[cnt]=v;
	head[u]=cnt;
	in[v]++;
}
int n;
static struct matrix{
	double num[N][N];
	matrix(int u=0){for(int i=1;i<=n;i++) num[i][i]=u;}
}p;
matrix swp;
matrix operator *(const matrix &a,const matrix &b)
{
	memset(swp.num,0,sizeof(swp.num));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
			swp.num[i][j]+=a.num[i][k]*b.num[k][j];
	return swp;
}
matrix res;
matrix ksm(matrix a,long long k)
{
	if(k==0) return 1;
	if(k==1) return a;
	res=ksm(a,k>>1);
	if(k&1) return res*res*a;
	else return res*res;
}
double num[N][N],val[N][N];
bool ban[N];
int hban[N],tot;
int cont[N];
double f[N][N];
int main()
{
	int m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ban[i]);
		if(ban[i]) hban[++tot]=i;
	}
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	for(int i=1;i<=n;i++) num[i][i]=1;
	for(int i=1;i<=n;i++)
	{
		val[i][i]=-1;
		for(int j=head[i];j;j=nxt[j])
		{
			int v=to[j];
			if(!ban[v])
			val[i][v]+=1.0/in[v];
		}
	}
	for(int i=1;i<=n;i++)
	{
		int u=i;
		for(int j=i+1;j<=n;j++)
		if(abs(val[u][i])<abs(val[j][i]))
		u=j;
		for(int j=i;j<=n;j++)
		swap(val[i][j],val[u][j]);
		for(int j=1;j<=n;j++)
		if(j!=i)
		{
			double t=val[j][i]/val[i][i];
			for(int k=1;k<=n;k++)
			{
				num[j][k]-=num[i][k]*t;
				val[j][k]-=val[i][k]*t;
			}
		}
	}
	hban[tot+1]=1;
	for(int i=1;i<=tot+1;i++)
	{
		memset(cont,0,sizeof(cont));
		int u=hban[i];
		for(int j=head[u];j;j=nxt[j]) cont[to[j]]++;
		for(int j=1;j<=n;j++)
		if(abs(val[j][j])>eps)
		{
			for(int k=1;k<=n;k++)
				f[u][j]+=-1.0/in[u]*cont[k]*num[j][k]/val[j][j];
		}
	}
	if(k==2){printf("%lf",f[1][n]);return 0;}
	n=tot;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		p.num[i][j]=f[hban[i]][hban[j]];
	p=ksm(p,k-2);
	double ans=0;
	for(int i=1;i<=n;i++) ans+=f[1][hban[i]]*p.num[i][n];
	printf("%.10lf",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define N 510
#define eps 1e-7
using namespace std;
int nxt[N<<1],to[N<<1],head[N],in[N],cnt;
void add(int u,int v)
{
	nxt[++cnt]=head[u];
	to[cnt]=v;
	head[u]=cnt;
	in[v]++;
}
int n;
static struct matrix{
	double num[N][N];
	matrix(int u=0){for(int i=1;i<=n;i++) num[i][i]=u;}
}p;
matrix swp;
matrix operator *(const matrix &a,const matrix &b)
{
	memset(swp.num,0,sizeof(swp.num));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
			swp.num[i][j]+=a.num[i][k]*b.num[k][j];
	return swp;
}
matrix res;
matrix ksm(matrix a,long long k)
{
	if(k==0) return 1;
	if(k==1) return a;
	res=ksm(a,k>>1);
	if(k&1) return res*res*a;
	else return res*res;
}
double num[N][N],val[N][N];
bool ban[N];
int hban[N],tot;
int cont[N];
double f[N][N];
int main()
{
	int m;
	long long k;
	scanf("%d%d%lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ban[i]);
		if(ban[i]) hban[++tot]=i;
	}
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	for(int i=1;i<=n;i++) num[i][i]=1;
	for(int i=1;i<=n;i++)
	{
		val[i][i]=-1;
		for(int j=head[i];j;j=nxt[j])
		{
			int v=to[j];
			if(!ban[v])
			val[i][v]+=1.0/in[v];
		}
	}
	for(int i=1;i<=n;i++)
	{
		int u=i;
		for(int j=i+1;j<=n;j++)
		if(abs(val[u][i])<abs(val[j][i]))
		u=j;
		for(int j=i;j<=n;j++)
		swap(val[i][j],val[u][j]);
		for(int j=1;j<=n;j++)
		if(j!=i)
		{
			double t=val[j][i]/val[i][i];
			for(int k=1;k<=n;k++)
			{
				num[j][k]-=num[i][k]*t;
				val[j][k]-=val[i][k]*t;
			}
		}
	}
	hban[tot+1]=1;
	for(int i=1;i<=tot+1;i++)
	{
		memset(cont,0,sizeof(cont));
		int u=hban[i];
		for(int j=head[u];j;j=nxt[j]) cont[to[j]]++;
		for(int j=1;j<=n;j++)
		if(abs(val[j][j])>eps)
		{
			for(int k=1;k<=n;k++)
				f[u][j]+=-1.0/in[u]*cont[k]*num[j][k]/val[j][j];
		}
	}
	if(k==2){printf("%lf",f[1][n]);return 0;}
	n=tot;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		p.num[i][j]=f[hban[i]][hban[j]];
	p=ksm(p,k-2);
	double ans=0;
	for(int i=1;i<=n;i++) ans+=f[1][hban[i]]*p.num[i][n];
	printf("%.10lf",ans);
	return 0;
}


#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#define N 610
#define M 110
#define db double
#define For(i, x, y) for (i = x; i <= y; i++)
using namespace std;
int i, j, k, n, m, K, t, nn;
int a[N], id[N], du[N];
db c[N][N], b[M][M], d[M];
inline void gaosi() {
  For(i, 1, n) {
    For(j, i, n) if (c[j][i]) {
      For(k, i, t) swap(c[i][k], c[j][k]);
      break;
    }
    for (j = t; j >= i; j--) c[i][j] /= c[i][i];
    For(j, i + 1, n) if (c[j][i]) for (k = t; k >= i; k--) c[j][k] -=
        c[j][i] * c[i][k];
  }
  for (i = n; i; i--)
    For(j, 1, i - 1) For(k, n + 1, t) c[j][k] -= c[j][i] * c[i][k];
  For(i, 1, nn) d[i] = c[1][n + i];
  For(i, 1, n) if (a[i]) For(j, 1, nn) b[id[i] - n][j] = c[i][j + n];
}
inline void mul() {
  int i, j;
  db a[M] = {};
  For(i, 1, nn) For(j, 1, nn) a[j] += d[i] * b[i][j];
  For(i, 1, nn) d[i] = a[i];
}
inline void multi() {
  int i, j, k;
  db a[M][M] = {};
  For(i, 1, nn) For(j, 1, nn) For(k, 1, nn) a[i][k] += b[i][j] * b[j][k];
  For(i, 1, nn) For(j, 1, nn) b[i][j] = a[i][j];
}
inline void work() {
  K -= 2;
  for (; K; K /= 2) {
    if (K & 1) mul();
    multi();
  }
  printf("%.12lf\n", d[nn]);
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  t = n;
  For(i, 1, n) {
    scanf("%d", &a[i]);
    if (a[i]) id[i] = ++t;
  }
  nn = t - n;
  For(i, 1, m) {
    int x, y;
    scanf("%d%d", &x, &y);
    du[x]++, du[y]++;
    if (a[y])
      c[x][id[y]]--;
    else
      c[x][y]++;

    if (a[x])
      c[y][id[x]]--;
    else
      c[y][x]++;
  }
  For(i, 1, n) c[i][i] -= du[i];

  gaosi();
  work();
  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;
}//hello


// by ¦Î
// program sky  :)

#include <bits/stdc++.h>

#define Rin register int
#define oo (c=getchar())
#define For(i,l,r) for(int _r=r,i=l;i<=_r;++i)
#define rep(i,l,r) for(int _r=r,i=l;i<_r;++i)
#define dto(i,r,l) for(int _l=l,i=r;i>=_l;--i)
#define pb push_back
#define clr(a) memset(a,0,sizeof a)
#define cpy(a,b) memcpy(a,b,sizeof a)

using namespace std;

typedef double db;
typedef vector<int> VI;

int n,m,N,d,K,safe[511],dang[511],id[511];
VI Ed[511];
db X[111],Y[111],E[111],T[511],pr[511],W[511],M[111][111],Q[111][111],A[511][511],B[511][511];

inline int IN(){
	char c;Rin x=0;for(;oo<48;);
	for(;c>47;oo)x=x*10+c-48;return x;
}

inline void Init(){
	For(i,1,N){
		++A[i][i];
		for(int v:Ed[safe[i]])if(id[v])
			A[i][safe[v]]-=pr[v];
	}
	For(i,1,N)B[i][i]=1;
	For(i,1,N){
		if(fabs(A[i][i])<1e-9){
			For(j,i+1,N)if(fabs(A[j][i])>1e-9){
				For(k,1,N)swap(A[i][k],A[j][k]),swap(B[i][k],B[j][k]);
				break;
			}
		}
		db x=1/A[i][i];
		For(j,1,N)A[i][j]*=x,B[i][j]*=x;
		For(j,1,N)if(i^j && fabs(A[j][i])>1e-9){
			x=A[j][i];
			For(k,1,N)A[j][k]-=A[i][k]*x,B[j][k]-=B[i][k]*x;
		}
	}
}

inline void gao(int S){
	clr(E);clr(W);clr(T);
	if(S==1)T[1]=1;
	else for(int v:Ed[S])if(id[v])T[id[v]]=pr[S];
	For(i,1,N)For(k,1,N)W[i]+=B[i][k]*T[k];
	For(i,1,d)
	for(int v:Ed[dang[i]])
	if(v==S)E[i]+=pr[S];
	else if(id[v])E[i]+=W[id[v]]*pr[v];
}

inline void Cst(){
	gao(1);
	For(i,1,d)X[i]=E[i];
	For(i,1,d){
		gao(dang[i]);
		For(j,1,d)M[j][i]+=E[j];
	}
}

inline void mul(){
	cpy(Q,M);clr(M);
	For(i,1,d)For(k,1,d)if(M[i][k])
	For(j,1,d)M[i][j]+=Q[i][k]*Q[k][j];
}

inline void prod(){
	cpy(Y,X);clr(X);
	For(i,1,d)For(k,1,d)X[i]+=M[i][k]*Y[k];
}

int main(){
	n=IN();m=IN();K=IN();
	For(i,1,n)if(IN())dang[++d]=i;else safe[id[i]=++N]=i;
	For(i,1,m){
		int u=IN(),v=IN();
		Ed[u].pb(v);Ed[v].pb(u);
		++pr[u];++pr[v];
	}
	For(i,1,n)pr[i]=1/pr[i];
	Init();
	Cst();
	for(K-=2;K;K>>=1,mul())if(K&1)prod();
	printf("%.20lf\n",X[d]);
}