Classical Hard Math Problem

Time limit: 1s Memory limit: 256MB Input: Output:

Statement

Mr. COACH\mathbb{Mr. \ COACH} is testing your programming skills with a problem he solved in his youth, when his informatics skills were much lower than they are now.The problem sounds as follows:
Find the sum of integers between 11 and NN (inclusive) that are not multiples of AA or BB.

Input data

The input comprises a single line featuring three integers, denoted as NN, AA, and BB, satisfying the inequalities 1N1 \leq N, AA, B109B \leq 10^9. These integers bear significance in accordance with the context provided in the problem statement.

Output data

Print the answer.

Example 1

stdin

10 3 5

stdout

22

Note

The integers between 11 and 1010 (inclusive) that are not multiples of 33 or 55 are 1,2,4,7,1,2,4,7, and 8,8, whose sum is 1+2+4+7+8=221+2+4+7+8=22.

Example 2

stdin

1000000000 314 159

stdout

495273003954006262

Log in or sign up to be able to send submissions!