import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // 最大公約数の取得 long gcd(long a, long b) { if (b == 0) return a; return gcd(b, a % b); } // 最小公倍数の取得 long lcm(long a, long b) { return a / gcd(a, b) * b; } // ================================================================== public void solve() { long T = Long.parseLong(sc.next()); long A = Long.parseLong(sc.next()); long B = Long.parseLong(sc.next()); if(T == 1) { out.println(0); return; } long ans = T / A - (T % A == 0 ? 1 : 0); // out.println(ans); ans += (T / B - (T % B == 0 ? 1 : 0)); // out.println(ans); long L = lcm(A, B); ans -= (T / L - (T % L == 0 ? 1 : 0)); out.println(ans+1); } // ================================================================== } class PP{ public int key, val; public PP(int key, int val) { this.key = key; this.val = val; } public int getKey() { return key; } public int getVal() { return val; } }