Subset Sum

3.2

6 votes
Problem

Peter is very weak in mathematics. His father gave him a problem and left to work. He is a lazy lad and he wants you to find the solution.

Given a set A which contains elements ranging from 1 to N.Find the sum of the elements in all possible subsets of the given set.

Input Format:

T, the number of test cases. Following T lines contain N, number of elements in set.

Output Format:

T lines indicating the subset sum. print the answer modulo (109+7).

Constraints: 

1<=T<=1000 1<=N<=2000

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?