using static System.Math; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var t = long.Parse(line[0]); var a = long.Parse(line[1]); var b = long.Parse(line[2]); var ma = Max(a, b); var mi = Min(a, b); var gcd = Gcd(a, b); var Lcm = (ma / gcd) * mi; var tpa = t / a; if (t % a == 0) tpa--; var tpb = t / b; if (t % b == 0) tpb--; var tpLcm = t / Lcm; if (t % Lcm == 0) tpLcm--; var ans = tpa + tpb + 1 - tpLcm; Console.WriteLine(ans); } static long Gcd(long a,long b) { if (a < b) return Gcd(b, a); while (b != 0) { var w = a % b; a = b; b = w; } return a; } }