#Lutece3225. 数学专题签到处

数学专题签到处

Migrated from Lutece 3225 数学专题签到处

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

给定常数 NN,共 QQ 次询问。

每次给定 xx,求

i=1N(3ix)\sum_{i=1}^N \binom{3i}{x}

答案对 109+710^9+7 取模。

Input

第一行,两个正整数 NNQQ

接下来 nn 行,每行一个正整数 xx

Output

QQ 行,每行一个整数,表示答案。

Samples

5 3
10
14
5
3069
15
3927

Constraints

1N1061\leq N\leq 10^61Q1051\leq Q \leq 10^51x3N1\leq x\leq 3N

Resources

2024 UESTC ICPC Training for Math