F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Harmonious Set

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 248    Accepted Submission(s): 98


Problem Description
For a giving integer n ( n > 0 ) , the set Sn consists of the non negative integers less than n. For example:S5 = {0,1,2,3,4}. A subset of Sn is harmonious if and only if the sum of its elements is a multiply of n. Now your task is easy. For a given n , you should find the number of harmonious subset of Sn.

 

Input
There is a number C in the first line , meaning there are C cases . C is guaranteed no more than 300.

Then C cases below. Each case is a positive integer n in a single line. n is not greater than 10^9.

 

Output
For each case , Output the answer mod 1000000007 in a single line .

 

Sample Input
5 1 2 3 10 1000
 

Sample Output
2 2 4 104 618918635
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 16:43:24, Gzip enabled