Home


Contest: Task: Related: TaskC TaskE

Score : $400$ points

Problem Statement

Find the sum of integers between $1$ and $N$ (inclusive) that are not multiples of $A$ or $B$.

Constraints

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

Input

Input is given from Standard Input in the following format:

$N$ $A$ $B$

Output

Print the answer.


Sample Input 1

10 3 5

Sample Output 1

22

The integers between $1$ and $10$ (inclusive) that are not multiples of $3$ or $5$ are $1,2,4,7$, and $8$, whose sum is $1+2+4+7+8 =22$.


Sample Input 2

1000000000 314 159

Sample Output 2

495273003954006262