import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long t = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long ans = 2 + (t - 1) / a; long g = gcd(a, b); long g1 = g * (a / g) * (b / g); ans -= (1 + (t - 1) / g1); ans += (t - 1) / b; System.out.println(ans); } public static long gcd(long a, long b) { if(b == 0) return a; return gcd(b, (a % b)); } }