SMALL - Smallest Number


Your task is extremely simple, for a given number N you have to find the smallest number which is divisible by all numbers from 1 to N without leaving any remainder. As the number can be very large print the answer modulo 1000000007.

Input

Input starts with a positive integer T < 501 in a single line, then T lines follow. Each of the T lines contains one positive integer N < 10001.

Output

For every N print the desired number.

Example

Input:
1
5

Output:
60

hide comments
hanstan: 2016-03-15 10:33:05

AC 0.00s in one go! XD
Just precompute all the values and voila!

kunal05: 2016-02-18 17:47:47

@Lakshman
Submission id 16311509
Why am i getting wrong answer?

dokz: 2016-01-21 06:31:40

Precalculate 10000 values using BigInteger, output with modulo => AC 0.55 :)

Last edit: 2016-01-21 06:31:50
ompr7371: 2015-09-03 10:53:43

hii @lakshman can you go through my submission id too ..my id is 15053864.i am getting wrong answer..


(Lakshman)==>Your algorithm is wrong.

Last edit: 2015-09-07 15:04:03
h_a_k_r: 2015-08-23 07:54:48

@Lakshman can you pls check whats going wrong in this one 14958211
Passing visible test cases and other I can think of but showing WA.
Pls respond asap.

Krzysztof Strojny: 2015-08-21 14:05:21

Fasttest Java solution in first go :D Cool problem

ompr7371: 2015-08-07 11:26:26

why i am getting TLE when my code runs in less than o(n^2)
pl help!!!
http://ideone.com/*****

=(Lakshman)=>Your algorithm is not correct.

Last edit: 2015-08-07 12:18:51
Abhay Jain: 2015-08-05 15:07:20

Since my link has been removed, where can i post my source code for u guys to help me out?
Or should i like submit my code even if its a wrong answer and u guys can then check it out or something...?

=(Lakshman)=>You can post your code here in forum http://www.spoj.com/forum/
=(Abhay)=> Okay thanks a heap :)

Last edit: 2015-08-05 18:35:50
Abhay Jain: 2015-08-05 10:08:02

Can anybody help me with my code. I just haven't programmed the end modulo part yet. So while going through test cases few of my outputs contained random negative integers. Here is the ideone link. http://ideone.com/*******SNIP********* The outputs of a few numbers like 299 and 10000 contain random negative numbers. If this is fixed I can add the end modulo part. Please help!!!! The outputs are big coz its without the modulo division

Last edit: 2015-08-05 11:07:04
Arun: 2015-07-22 08:18:47

@[Lakshman]
Can you please go through my submission(14721001).Can't figure out if there is an error in logic or precision issue.

=(Lakshman)=>You have precision issue at line 51, your algorithm is correct.

=(Arun)=>I am still having some trouble figuring it out. Is there something I need to learn to be able to fix this?

=(Arun)=> Never mind. Figured it out.
Great Question.

Last edit: 2015-07-23 09:08:24

Added by:[Lakshman]
Date:2015-01-24
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 JS-MONKEY