Once upon a time, there was a curious mathematician named Alice. She loved playing with numbers. One day, she encountered a challenge. In this challenge, she had to assume that a magical box containing numbers from 1 to N existed, and she had to select M distinct numbers from this box such that the sum of their divisors was the greatest, and then report this maximum possible sum of their divisors.
Alice had to solve this puzzle multiple times for various values of N and M since she was quite busy she asked for your help.
The rules of the challenge are:
Input format
Output format
For each puzzle, print in a new line the maximum total sum of the divisors of M distinct numbers from 1 to N.
Constraints
1≤T≤1061≤M≤N≤2×106
For puzzle 1:
In this, you need to to choose 3 numbers from 1 to 7 such that there total sum of the divisors is the maximum possible. You can pick numbers 4, 6, and 7 and get the total sum of divisors as 27. This is because:
therefore we can get the maximum total sum of divisors by choosing 4, 6 & 7. Thus, the answer is ((1+2+4) + (1+2+3+6) + (1+7)) = 27