Problem: Today DZY begins to play an old game. In this game, he is in a big maze with n rooms connected by m corridors (each corridor allows to move in both directions). You can assume that all the rooms are connected with corridors directly or indirectly.

DZY has got lost in the maze. Currently he is in the first room and has k lives. He will act like the follows:

  * Firstly he will randomly pick one of the corridors going from his current room. Each outgoing corridor has the same probability to be picked. 
  * Then he will go through the corridor and then the process repeats. 



There are some rooms which have traps in them. The first room definitely has no trap, the n-th room definitely has a trap. Each time DZY enters one of these rooms, he will lost one life. Now, DZY knows that if he enters the n-th room with exactly 2 lives, firstly he will lost one live, but then he will open a bonus round. He wants to know the probability for him to open the bonus round. Please, help him.

Input

The first line contains three integers n, m, k (2 ≤ n ≤ 500; 1 ≤ m ≤ 105; 2 ≤ k ≤ 109).

The second line contains n integers, each of them is either 0 or 1. If the i-th number is 1, then the i-th room has a trap, otherwise it has not a trap. Please note, that the number of rooms with a trap is no more than 101. It is guaranteed that the first room has no trap, and the n-th room has a trap.

Then m lines follows. Each of them contains two integers ui, vi (1 ≤ ui, vi ≤ n; ui ≠ vi), meaning that current corridor connects two rooms ui and vi. It is guaranteed that the corridor system is connected.

Output

Print the only real number — the probability for DZY to open the bonus round. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4.

Examples

Input

5 5 3
0 0 1 0 1
1 2
2 3
3 4
4 5
1 2


Output

0.25000000


Input

3 2 2
0 1 1
1 2
2 3


Output

-0.00000000


Input

2 1 3
0 1
1 2


Output

1.00000000

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    private int n;
    private int[] degree;
    private int[][] edgeCount;
    private boolean[] hasTrap;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        degree = new int[n];
        edgeCount = new int[n][n];
        hasTrap = new boolean[n];
        int trapCount = 0;
        for (int i = 0; i < n; ++i) {
            hasTrap[i] = in.nextInt() == 1;
            if (hasTrap[i])
                ++trapCount;
        }
        for (int i = 0; i < m; ++i) {
            int u = in.nextInt() - 1;
            int v = in.nextInt() - 1;
            ++edgeCount[u][v];
            ++edgeCount[v][u];
            ++degree[u];
            ++degree[v];
        }
        double[][] coef = getCoefficient();
        double[][] base = new double[trapCount][trapCount];
        double[][] first = new double[trapCount][1];
        for (int u = 0, x = 0; u < n; ++u)
            if (hasTrap[u]) {
                for (int v = 0, y = 0; v < n; ++v)
                    if (hasTrap[v]) {
                        double got = 0;
                        for (int z = 0; z < n; ++z)
                            got += coef[u][z] * edgeCount[z][v] / degree[z];
                        base[y][x] = got;
                        ++y;
                    }
                double got = 0;
                for (int z = 0; z < n; ++z) {
                    got += coef[0][z] * edgeCount[z][u] / degree[z];
                    first[x][0] = got;
                }
                ++x;
            }
        out.printf("%.9f\n", matrixMultiply(matrixPow(base, k - 2), first)[trapCount - 1][0]);
    }

    private double[][] matrixPow(double[][] a, int n) {
        double[][] res = unitMatrix(a.length);
        for (; n > 0; n >>= 1) {
            if ((n & 1) == 1)
                res = matrixMultiply(res, a);
            a = matrixMultiply(a, a);
        }
        return res;
    }

    private double[][] matrixMultiply(double[][] a, double[][] b) {
        int m = a.length;
        int n = a[0].length;
        int p = b[0].length;
        double[][] c = new double[m][p];
        for (int i = 0; i < m; ++i)
            for (int j = 0; j < p; ++j) {
                double got = 0;
                for (int k = 0; k < n; ++k)
                    got += a[i][k] * b[k][j];
                c[i][j] = got;
            }
        return c;
    }

    private double[][] unitMatrix(int n) {
        double[][] res = new double[n][n];
        for (int i = 0; i < n; ++i)
            res[i][i] = 1;
        return res;
    }

    private double[][] getCoefficient() {
        double[][] a = new double[n][n];
        double[][] b = new double[n][n];
        for (int i = 0; i < n; ++i) {
            a[i][i] = b[i][i] = 1;
            for (int j = 0; j < n; ++j)
                if (!hasTrap[j])
                    a[i][j] += -1.0 * edgeCount[i][j] / degree[i];
        }
        for (int v = 0; v < n; ++v) {
            for (int e = v + 1; e < n; ++e) {
                double coef = -a[e][v] / a[v][v];
                for (int p = v; p < n; ++p)
                    a[e][p] += coef * a[v][p];
                for (int p = 0; p < n; ++p)
                    b[e][p] += coef * b[v][p];
            }
        }
        double[][] coef = new double[n][];
        for (int e = n - 1; e >= 0; --e) {
            coef[e] = b[e].clone();
            for (int v = e + 1; v < n; ++v)
                for (int p = 0; p < n; ++p)
                    coef[e][p] -= a[e][v] * coef[v][p];
            for (int p = 0; p < n; ++p)
                coef[e][p] /= a[e][e];
        }
        return coef;
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        try {
            while(tokenizer == null || !tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }