#arc145b. [arc145_b]AB Game

[arc145_b]AB Game

Problem Statement

The following game is called Game nn:

The game is played by Alice and Bob. Initially, there are nn stones.

The players alternate turns, making a move described below, with Alice going first. The player who becomes unable to make a move loses.

  • In Alice's turn, she must remove a number of stones that is a positive multiple of AA.
  • In Bob's turn, he must remove a number of stones that is a positive multiple of BB.

In how many of Game 11, Game 22, ..., Game NN does Alice win when both players play optimally?

Constraints

  • 1leqN,A,Bleq10181 \\leq N ,A,B \\leq 10^{18}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN AA BB

Output

Print the answer.


Sample Input 1

4 2 1

Sample Output 1

2

In Game 11, Alice cannot make a move and thus loses.

In Game 22, Alice removes 22 stones, and then Bob cannot make a move: Alice wins.

In Game 33, Alice removes 22 stones, Bob removes 11 stone, and then Alice cannot make a move and loses.

In Game 44, Alice removes 2times2=42 \\times 2 = 4 stones, and then Bob cannot make a move: Alice wins.

Therefore, Alice wins in two of the four games.


Sample Input 2

27182818284 59045 23356

Sample Output 2

10752495144