403550: GYM101193 A Street magic

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Street magictime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Ladies and gentlemen, David Blaine is back! Having realized that street magic is not as captivating to his audience as in the beginning of his career, David started having doubts about his capabilities. However after giving it another thought he understood that math magic is the new trend in the entertainment industry. We all know David does not bother about easy stuff and he loves stunning the crowd, so he decided to do a famous, but not yet performed by anyone trick with tens.

Here are the trick details. Two people from the audience pick an integer number each. Let's denote these numbers n and m. After that David calculates in his head the secret number x (it takes precisely 0.42 seconds). So what is so special about x? It is a positive integer number not greater n such that for any k > 0. David found out that there could be very many such numbers, so he wants to know exactly how many exist for given n and m.

Note: is modulo operation which finds the remainder after division of one number by another.

Input

The first input line contains two positive integer numbers n and m which were picked by the audience.

1 ≤ n, m ≤ 1050
Output

The only output line should contain the number of possible secret numbers x modulo 109 + 7 for the given n and m.

ExampleInput
72 4
Output
42

加入题单

上一题 下一题 算法标签: