All Tracks Problem

Broker Ding Ding
/
No tags
Problem
Editorial
Analytics

After leaving the job given by Makkunda, you are left with a lot of money. So, you decide to invest this money and come to the infamous broker Ding Ding ( a.k.a. 10 ke 21 ). He offers you a deal in which every \( n+1^{th} \) week you will recieve money which is equal to n times the sum of money you received from week 1 to week n. On week 1 he will give you 1 rupee. You decide to accept the deal and wonder how much will you earn on the \( i^{th} \) week. Naturally, you decide to write a program to do this task.

You have to write a program that accepts q queries ,each corresponding to a week number and outputs the money you will receive on that week. As your earning can be humongous, output the answer modulo \( 10^9 + 7 \)

Hint:
Money earned on week \( i+1 \) denoted by \( a_{n+1} \) is equal to \( n\displaystyle \sum_{i=1}^{n}{a_i} \) and \( a_1 = 1 \)

Input:

First line contains the integer q . It is followed by q lines. Each line contains a integer n .

Output:

For each query print the \( a_n \) (the money you earn in \( n^{th} \) week ) in a new line.

Constraints:

\( 1 \leq n \leq 10^9 \)

\( 1 \leq q \leq 10 \)

Useful Links: Modulo

SAMPLE INPUT
2
2
3
SAMPLE OUTPUT
1
4
Explanation

\( a_1 = 1, a_2 = 1, a_3 = 4 \)

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?