const stdin = require("fs").readFileSync("/dev/stdin", "UTF8"); const [t, a, b] = stdin.split(/\s/).filter(x=>x).map(x=>BigInt(x)); function gcd(a, b) { function gcd_core(a, b) { return b ? gcd_core(b, a % b) : a; } return a > b ? gcd_core(a, b) : gcd_core(b, a); } const g = gcd(a, b); const l = a * b / g; const bus1 = (t + a - 1n) / a; const bus2 = (t + b - 1n) / b; const busomni = (t + l - 1n) / l; console.log((bus1 + bus2 - busomni).toString());