luogu#P4345. [SHOI2015] 超能粒子炮·改

[SHOI2015] 超能粒子炮·改

Problem Description

The inventor SHTSC, who once created the Brain-hole Therapy Device and the Super Particle Cannon, has now unveiled his new invention: Super Particle Cannon · Modified — a mysterious device that can fire particle streams with much greater power.

Compared with the Super Particle Cannon, Super Particle Cannon · Modified has a fundamental increase in power. It has two parameters n,kn, k. It fires, at each position ii numbered from 00 to kk inclusive, a particle stream with power Cnimod2333C_{n}^{i} \bmod 2333.

Now SHTSC gives you the parameters of his Super Particle Cannon · Modified. Please compute the remainder modulo 23332333 of the sum of the powers of the particle streams it fires.

Input Format

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

Then follow tt lines. Each line contains two integers n,kn, k, as described above.

Output Format

Output tt lines. Each line contains one integer: the value of the sum of the powers modulo 23332333.

3
5 5
10 7
1145 14
32
968
763

Hint

For 10%10\% of the testdata, t=1t = 1, n,k1000n, k \le 1000.
For 30%30\% of the testdata, t=1t = 1, n,k1000000n, k \le 1000000.
For 50%50\% of the testdata, t=1t = 1, n1018n \le 10^{18}, k1000k \le 1000.
For 70%70\% of the testdata, t=100t = 100, n,k1018n, k \le 10^{18}.
For 100%100\% of the testdata, t=100000t = 100000, n,k1018n, k \le 10^{18}.

Translated by ChatGPT 5