Xu1024 is a boy who is responsible for fixing the bug of HOJ.
Because the Hunan university ACM freshman competition is coming, Xu1024 find that HOJ still has a lot of functions not realized. To solve this problem, Xu1024 had to work a 996 schedule.
Unfortunately, Xu1024 was carried into the ambulance because of exhaustion. More unfortunate thing happened, There is something wrong with the ambulance's electrical system. The electrical system of the ambulance is very special. There are N wires in system A and N wires in system B, and the ambulance can restart when any i-th wire in system A is connected to line the Ai-th wire in system B. The A1,A2,...An is a premutation of n.
In order to save the child, you decide to reconnect the electric
wire so that every
wire in system B will be connected with a unique line in system A. How many ways can the ambulance restart? Due to the answer will be very large, you only need to output the answer mod 1,000,000,007.