logo AlgoBeat OnlineJudge
登录 注册

#217593. [ICPC 2019 Yinchuan R] Crazy Cake

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Mr. Li buys a circular strawberry cake on his birthday, and the pastry chef puts identical strawberries around the cake evenly. Now Mr. Li wants to divide the cake following the rules below:

  • Each cutting track must be a segment connecting two strawberries.
  • Any two cutting tracks cannot intersect strictly inside the cake, but they may share a common strawberry.

Note that cutting tracks are allowed to connect two adjacent strawberries, and Mr. Li can also do nothing.

You are asked to help Mr. Li calculate the number of different ways in cutting the cake. Two ways are regarded as the same if they coincide after rotating the cake. Since the answer could be very large, you only need to tell him the answer modulo .

输入格式

The first line contains an integer , the number of test cases.

Each of the test cases contains an integer , the number of strawberries.

输出格式

For each test case, output an integer denotes the number of different ways of cutting the cake modulo .

样例

样例输入 1

2 
2 
3

样例输出 1

2
4

数据范围与提示

The following figure shows the ways of cutting the cake with strawberries.

:::align{center} :::