URI Online Judge | 1512

Tiles

By Cristhian Bonilha, UTFPR BR Brazil

Timelimit: 1

Rafael decided to change the tiles from his living room, and for that he made some measurements and bought N white tiles from the store.

The fact that all the tiles are white got Rafael's attention about the design of his living room, and then he decided to paint some of the tiles to give a “modern air” to his house.

He positioned all the N tiles in a straight line, and enumerated all of them from 1 to N, from the left to the right.

To choose which tiles to paint, he thought about the following: Chose two integers A and B, and said he was going to paint all the tiles which enumeration was multiple of A and/or B.

Help Rafael to find out how many tiles are going to be painted at the total.

Input

There will be several test cases. Each test case has three integers, N, A and B (3 ≤ N ≤ 10⁹, 2 ≤ A, BN).

The last test case is indicated when N = A = B = 0, which should not be processed.

Output

 For each test case, print one line containing one integer, representing how many tiles are going to painted.

Sample Input Sample Output

10 2 3
50 5 7
1000000 28 32
0 0 0

7
16
62500