Divisible by Both
By Kay Akashi
Time: 1000 ms
Memory: 256000 kB
The code judging system is only available during contests. Check out the
github repo for test cases and solutions.
Problem Statement
Given integers n, a, b, count the number of i (1≤i≤n) such that i is divisible by both a and b.
In the first example, set of i that satisfy the condition are 12 and 24. Hence the answer is 2.
In the second example, there's no i that satisfies the condition whatsoever. Hence 0.
Constraints
1≤n≤109, 1≤a,b≤300.
Subtask 1 (30%)
0≤n<105.
Subtask 2 (70%)
105≤n≤109.
Input
The input contains three integers, n, a, and b.
Output
Output the answer.
Examples