atcoder#ABC253D. [ABC253D] FizzBuzz Sum Hard

[ABC253D] FizzBuzz Sum Hard

Score : 400400 points

Problem Statement

Find the sum of integers between 11 and NN (inclusive) that are not multiples of AA or BB.

Constraints

  • 1N,A,B1091 \leq N, A,B \leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN AA BB

Output

Print the answer.

10 3 5
22

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

1000000000 314 159
495273003954006262