#P7976. 「Stoi2033」园游会

「Stoi2033」园游会

Background

Under the blazing sun, I only want to hold an umbrella for you.
You lean on my shoulder, taking a deep breath, afraid you will forget.
Because of that silly fish-scooping game, we started talking.
I really hope the topics never end, and the carnival never closes.
A balloon in my hand, I hold yours and wander around.
I have something I want to tell you, but your eyes pretend to be busy.
I want to taste both the egg cakes and the jam at the corner of your lips.
The carnival video is playing; this world has agreed to wander together.
—— "Carnival"

Problem Description

Let F(x)=(x+1)mod31F(x)=(x+1)\bmod 3-1. Given nn, compute:

l=0nr=lnF(Crl)\sum_{l=0}^n \sum_{r=l}^n F\left(C_{r}^{l}\right)

modulo 17320739991732073999. Here CrlC_{r}^{l} is a binomial coefficient, specifically:

Crl=r!l!(rl)!C_{r}^{l}=\dfrac{r!}{l!(r-l)!}

Input Format

This problem has multiple queries.

The first line contains two positive integers t,maxnt,maxn, representing the number of queries and the maximum possible value among the queries.

The next tt lines each contain one positive integer nn.

Output Format

Output tt lines. The ii-th line contains one integer: the answer to the ii-th query modulo 1 732 073 9991\ 732\ 073\ 999.

4 173
1
5
20
34
3
12
52
94

Hint

Constraints

This problem uses bundled testdata.

Subtask Score 1t1\le t \le 1nmaxn1\le n \le maxn \le
11 1616 11 300300
22 3737 300300 7×1067 \times 10^6
33 4747 3×1043 \times 10^4 2×10162 \times 10^{16}

For 100%100\% of the testdata, $1 \le t \le 3 \times 10^4,1 \le n \le maxn \le 2 \times 10^{16}$.

Translated by ChatGPT 5