题目描述
Problem :
Baba wants to kill Guruji. He has a master plan but Guruji is prepared for him.
Baba released a bacterial concentration of 1 unit in Guruji's underground water source on Day 0. The concentration of bacteria becomes x times the concentration day before. But,Guruji's powder kills y units of bacteria each day, starting from Day 1.
Guruji needs your help to estimate the concentration of bacteria on the N th day.
Note : Large Input/Output Data. Use fast I/O.
Input :
First line consists of 2 space separated integers x and y. The next line consists of a single integer Q, denoting the number of queries Guruji has for you. The next Q lines are such that each line consists of a single integer N.
Output :
For each query of Guruji, print the number of bacteria present on the N th day on a new line. Since the answer can be really huge, print the answer modulo 1000000007 (10^9 + 7) .
Constraints :
2 ≤ x ≤ 100
0 ≤ y ≤ (x-2)
1 ≤ Q ≤ 10^6
1 ≤ N ≤ 10^6
Problem Setter : Sayan
Problem Tester : Sandeep , Himanshu
(By IIT Kgp HackerEarth Programming Club)
SAMPLE INPUT
5 3
3
1
3
2
SAMPLE OUTPUT
2
32
7
输入格式
见题面
输出格式
见题面