CF285D.Permutation Sum

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Permutation pp is an ordered set of integers p1,p2,...,pnp_{1},p_{2},...,p_{n} , consisting of nn distinct positive integers, each of them doesn't exceed nn . We'll denote the ii -th element of permutation pp as pip_{i} . We'll call number nn the size or the length of permutation p1,p2,...,pnp_{1},p_{2},...,p_{n} .

Petya decided to introduce the sum operation on the set of permutations of length nn . Let's assume that we are given two permutations of length nn : a1,a2,...,ana_{1},a_{2},...,a_{n} and b1,b2,...,bnb_{1},b_{2},...,b_{n} . Petya calls the sum of permutations aa and bb such permutation cc of length nn , where ci=((ai1+bi1) mod n)+1c_{i}=((a_{i}-1+b_{i}-1)\ mod\ n)+1 (1<=i<=n)(1<=i<=n) .

Operation means taking the remainder after dividing number xx by number yy .

Obviously, not for all permutations aa and bb exists permutation cc that is sum of aa and bb . That's why Petya got sad and asked you to do the following: given nn , count the number of such pairs of permutations aa and bb of length nn , that exists permutation cc that is sum of aa and bb . The pair of permutations x,yx,y (xy)(x≠y) and the pair of permutations y,xy,x are considered distinct pairs.

As the answer can be rather large, print the remainder after dividing it by 10000000071000000007 ( 109+710^{9}+7 ).

输入格式

The single line contains integer n (1<=n<=16)n\ (1<=n<=16) .

输出格式

In the single line print a single non-negative integer — the number of such pairs of permutations aa and bb , that exists permutation cc that is sum of aa and bb , modulo 10000000071000000007 ( 109+710^{9}+7 ).

输入输出样例

  • 输入#1

    3
    

    输出#1

    18
    
  • 输入#2

    5
    

    输出#2

    1800
    
首页