Broker Ding Ding

0

0 votes
Easy
Problem

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+1th 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 ith 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 109+7

Hint:
Money earned on week i+1 denoted by an+1 is equal to nni=1ai and a1=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 an (the money you earn in nth week ) in a new line.

Constraints:

1n109

1q10

Useful Links: Modulo

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

a1=1,a2=1,a3=4

Editor Image

?