Fake Math Problem
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Given the sequence  ,ask the value of 

wikipedia: k-permutations of n are the different ordered arrangements of a k-element subset of an n-set (sometimes called variations or arrangements in the older literature). These objects are also known as partial permutations or as sequences without repetition, terms that avoid confusion with the other, more common, meaning of "permutation". The number of such k-permutations of n is denoted variously by such symbols as  or ,and its value is given by the product ,which is  when , and otherwise is equal to .

Assume that 

输入描述:

The first line contains an integer  — the number of test cases you need to solve.

The first line of each test case contains an integer .

The second line contains  space-separated integers  — the elements of the array a.

输出描述:

For each test case, print the result mod naughty .
示例1

输入

复制
1
5
0 1 1 3 2 4

输出

复制
245

说明

\sum\limits_{i=0}^{0}{P(0, i)}=1

\sum\limits_{i=0}^{1}{P(1, i)}=1+1=2

\sum\limits_{i=0}^{1}{P(2, i)}=1+2=3

\sum\limits_{i=0}^{3}{P(3, i)}=1+3+6+6=16

\sum\limits_{i=0}^{2}{P(4, i)}=1+4+12=17

\sum\limits_{i=0}^{4}{P(5, i)}=1+5+20+60+120=206