0.ST. KPath


Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 98M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, C, C++, C11, CLANG, CLANGX, Classical, COBOL, Coffee, CSC, D lang, DART, F95, FORTH, Fortrn, GAS32, GO, Haskell, Itercal, Java, kotlin, LEAN, LISP, LUA, MONOVB, Nasm, OCAML, Pascal, Perl, php, PIKE, prolog, Pypy, Python, Ruby 2, RUST, Scala, SCM, SED, SWIFT, TCL, TUR, V8JS, VB, ZIG

A k-path on a given undirected graph is a path having exactly k edges and containing no repeated nodes. Given an undirected graph G and an integral value k, count how many k-paths on G. There six 3-paths on the graph in Figure 1 which are: 1-2-3-4, 2-3-4-1, 3-4-1-2, 4-1-2-3, 2-1-3-4, 4-1-3-2

Input

The input consists of following lines

? Line 1: contains two integer n and k (1 = < n = < 30, 1 = < k = < 10) in which n is the number of nodes of the graph G (nodes are numbered 1,2,...,n)

? Line 2: contains an integer m (1 = < m = < 60) which is the number of edges of G

? Line i + 2: contains two integers u and v representing two end points of the ith edge of G (8i = 1;......m)

Output

The output contains the number of k-paths of G

Example

Input

4 3

5

1 2

1 3

1 4

2 3

3 4

Output

6


Comments

There are no comments at the moment.