#P17262. [ICPC 2017 Urumqi R] Fence Building

    ID: 16790 Type: RemoteJudge 1000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 7 Uploaded By: Tags>2017平面图欧拉公式组合数学排列组合ICPC

[ICPC 2017 Urumqi R] Fence Building

题目描述

Farmer John owns a farm. He first builds a circle fence. Then, he will choose nn points and build some straight fences connecting them. Next, he will feed a cow in each region so that cows cannot play with each other without breaking the fences. In order to feed more cows, he also wants to have as many regions as possible. However, he is busy building fences now, so he needs your help to determine what is the maximum number of cows he can feed if he chooses these nn points properly.

:::align{center} :::

输入格式

The first line contains an integer 1≤T≤1000001 \le T \le 100000, the number of test cases. For each test case, there is one line that contains an integer nn. It is guaranteed that 1≤T≤1051 \le T \le 10^5 and 1≤n≤10181 \le n \le 10^{18}.

输出格式

For each test case, you should output a line "Case #ii: ans" where ii is the test case's number, starting from 11 and ans is the remainder of the maximum number of cows farmer John can feed when divided by 109+710^9 + 7.

3
1
3
5
Case #1: 1
Case #2: 4
Case #3: 16