We are given a permutation sequence a1,a2,...,an of numbers from 1 to n. Let's assume that in one second, we can choose some disjoint pairs (u1,v1),(u2,v2),...,(uk,vk) and swap all aui and avi for every i at the same time (1≤ui<vi≤n). The pairs are disjoint if every ui and vj are different from each other.
We want to sort the sequence completely in increasing order as fast as possible. Given the initial permutation, calculate the number of ways to achieve this. Two ways are different if and only if there is a time t, such that the set of pairs used for swapping at that time are different as sets (so ordering of pairs doesn't matter). If the given permutation is already sorted, it takes no time to sort, so the number of ways to sort it is 1.
To make the problem more interesting, we have k holes inside the permutation. So exactly k numbers of a1,a2,...,an are not yet determined. For every possibility of filling the holes, calculate the number of ways, and print the total sum of these values modulo 1000000007 (109+7).
Output
Print the total sum of the number of ways modulo
1000000007 (109+7).