TABLE - Crash´s number table

In today's math lesson, Little Crash has just learnt Least Common Multiple (LCM). For two positive integers a and b, LCM(a, b) means the minimum positive integer which can be divisible by a and b.

After coming home, Crash is still thinking about what he learnt in the math lesson. Then he draw a table filled numbers in order to research LCM. The table has N rows and M columns. The number in the ith row and jth column is LCM(i, j).

A table of 4*5 is just like this:

1 2 3 4 5
2 2 6 4 10
3 6 3 12 15
4 4 12 4 20

Now Little Crash wants to know the sum of all the numbers in the table. You just need to output the sum modulo 20101009.

Input

Only two positive integers stand for N and M. (N, M <= 107)

Output

A positive integer which means the sum modulo 20101009.

Example

Input:
4 5

Output:
122

Added by:jiazhipeng
Date:2010-12-20
Time limit:0.100s-1.274s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP C99 JAVA PAS-GPC PAS-FPC
Resource:Modified from task energy of NOI 2010

hide comments
2024-03-15 01:41:45
My solution runs about 0.2 second on my PC.But it gets TLE!

Last edit: 2024-03-15 01:42:11
2011-09-09 06:52:19 Rohmad Raharjo
Would you like give me another test cases?
2011-01-18 02:40:18 Nikmal Mursyidah
how to make a program runs faster?
my program always get TLE..
2010-12-25 06:14:36 mike_nzk
My program runs about 1.4 seconds on my PC but gets TLE in SPOJ. It's so strange!
update:I finally AC the problem using a program running about 1.0 second on my PC.

Last edit: 2010-12-25 07:44:59
2010-12-22 14:07:44 jiazhipeng
to xilinx
I didnt' do in that way because some parts of the program can run only once, but I want you to find the best solution for this part.
2010-12-22 13:55:06 [Rampage] Blue.Mary
There's no need to set time limit 0.1 second for some test cases. I think a better way is to merge all test cases in 1 file and give out the total time limit. See problems added by me.

Last edit: 2010-12-22 13:56:09
2010-12-22 02:47:08 jiazhipeng
to pratik:
My solution runs about 1 second on my PC.
2010-12-21 21:00:52 .:: Pratik ::.
Is time limit strict the code in C++ runs on my machine in 5 seconds for worst case.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.