提示: 欢迎访问OurACM平台。
Problem 1627 Revival's road

Accept: 199    Submit: 407
Time Limit: 5000 mSec    Memory Limit : 32768 KB

Problem Description

Oaiei is idle, and recently he wants to travel around the country. In his country there are N cities, they are numbered from 1 to N. There are roads between some cities, but some are not directly connected with each other. Oaiei lives in the city 1, and he wants to go to city N. Now, he has a question. In k steps, he would like to know there are how many ways from city 1 to city N. You should note that althought there is a road between city A and city B, there is not necessarily a road between city B and city A.

Input

There are multiple tests. For each test, the first line contains three integers N、M and k(2<=N<=100,1<=M<=N*N,1<=k<=10^9), N denotes the number of cities, M denotes the number of roads between the N cities. Following M lines, each line contains two integers A and B, denoting there is a road between city A and city B.

Output

There are how many ways from city 1 to city N. Becase the answer can be very large, you should output the answer MOD 10000.

Sample Input

4 5 9 1 2 2 3 3 4 4 1 1 3 4 5 1 1 2 2 3 3 4 4 1 1 3

Sample Output

3 0

Source

Summer Training Qualification II

Submit  Back  Status  Discuss