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.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
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 {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int N = in.nextInt();
        int M = in.nextInt();
        int K = in.nextInt();

        N++;
        int[] isTrap = new int[N];
        ArrayList<Integer> traps = new ArrayList<Integer>();
        for (int i = 0; i < N - 1; i++) {
            isTrap[i] = in.nextInt();
            if (isTrap[i] == 1) {
                traps.add(i);
            }
        }
        isTrap[N - 1] = 1;
        traps.add(N - 1);
        int T = traps.size();

        int[] deg = new int[N];
        int[][] adj = new int[N][N];
        for (int i = 0; i < M; i++) {
            int a = in.nextInt() - 1;
            int b = in.nextInt() - 1;
            deg[a]++;
            deg[b]++;
            adj[a][b]++;
            adj[b][a]++;
        }
        adj[N - 1][0]++;
        deg[N - 1]++;

        double[][] A = new double[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (isTrap[j] == 0) {
                    A[i][j] = (double) -adj[i][j] / deg[i];
                }
            }
            A[i][i] = 1.0;
        }
        double[][] inv = inverse(A);

        double[][] C = new double[T][T];
        for (int dest = 0; dest < T; dest++) {
            for (int i = 0; i < T; i++) {
                for (int j = 0; j < N; j++) {
                    double prob = (double) adj[j][traps.get(dest)] / deg[j];
                    C[i][dest] += inv[traps.get(i)][j] * prob;
                }
            }
        }

        double[][] R = new double[T][T];
        for (int i = 0; i < T; i++) {
            R[i][i] = 1.0;
        }

        K--;
        while (K > 0) {
            if ((K & 1) > 0) {
                R = mult(R, C);
            }
            C = mult(C, C);
            K >>= 1;
        }

        out.println(R[T - 1][T - 2]);
    }

    private double[][] inverse(double[][] A) {
        int N = A.length;
        double[][] B = new double[N][2 * N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                B[i][j] = A[i][j];
            }
            B[i][i + N] = 1.0;
        }

        for (int j = 0; j < N; j++) {
            double coef = B[j][j];
            for (int q = j; q < 2 * N; q++) {
                B[j][q] /= coef;
            }
            for (int i = 0; i < N; i++) {
                if (i != j) {
                    coef = -B[i][j];
                    for (int q = j; q < 2 * N; q++) {
                        B[i][q] += B[j][q] * coef;
                    }
                }
            }
        }

        double[][] C = new double[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                C[i][j] = B[i][j + N];
            }
        }

        return C;
    }


    private double[][] mult(double[][] A, double[][] B) {
        double[][] C = new double[A.length][B[0].length];
        for (int i = 0; i < A.length; i++) {
            for (int j = 0; j < B[0].length; j++) {
                for (int k = 0; k < A[0].length; k++) {
                    C[i][j] += A[i][k] * B[k][j];
                }
            }
        }
        return C;
    }

}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

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

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

}