T,A,B=map(int,input().split()) T+=1 ans=0 ans+=T//A ans+=T//B if B>A: A,B=B,A X=A*B while A%B!=0: A,B=B,A%B gcd=B print(ans-T//(X//B))