import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { Main o = new Main(); o.solve(); } public void solve() { FastScanner sc = new FastScanner(System.in); long T = sc.nextLong(); long A = sc.nextLong(); long B = sc.nextLong(); long g = gcd(A, B); long ans = (T - 1L) / A + (T - 1L) / B - (T - 1L) / (A / g) / B + 1L; System.out.println(ans); } // 最大公約数を計算する static long gcd(long a, long b) { while ( b != 0 ) { long tmp = b; b = a % b; a = tmp; } return a; } class FastScanner { private final InputStream in; private final byte[] buf = new byte[1024]; private int ptr = 0; private int buflen = 0; FastScanner( InputStream source ) { this.in = source; } private boolean hasNextByte() { if ( ptr < buflen ) return true; else { ptr = 0; try { buflen = in.read(buf); } catch (IOException e) { e.printStackTrace(); } if ( buflen <= 0 ) return false; } return true; } private int readByte() { if ( hasNextByte() ) return buf[ptr++]; else return -1; } private boolean isPrintableChar( int c ) { return 33 <= c && c <= 126; } private boolean isNumeric( int c ) { return '0' <= c && c <= '9'; } private void skipToNextPrintableChar() { while ( hasNextByte() && !isPrintableChar(buf[ptr]) ) ptr++; } public boolean hasNext() { skipToNextPrintableChar(); return hasNextByte(); } public String next() { if ( !hasNext() ) throw new NoSuchElementException(); StringBuilder ret = new StringBuilder(); int b = readByte(); while ( isPrintableChar(b) ) { ret.appendCodePoint(b); b = readByte(); } return ret.toString(); } public long nextLong() { if ( !hasNext() ) throw new NoSuchElementException(); long ret = 0; int b = readByte(); boolean negative = false; if ( b == '-' ) { negative = true; if ( hasNextByte() ) b = readByte(); } if ( !isNumeric(b) ) throw new NumberFormatException(); while ( true ) { if ( isNumeric(b) ) ret = ret * 10 + b - '0'; else if ( b == -1 || !isPrintableChar(b) ) return negative ? -ret : ret; else throw new NumberFormatException(); b = readByte(); } } public int nextInt() { return (int)nextLong(); } public double nextDouble() { return Double.parseDouble(next()); } } }