import numpy as np t,a,b=map(int,input().split()) tmp=np.lcm(a,b) if t>=tmp: cnt=0 cnt+=tmp//a cnt+=tmp//b cnt-=1 b=t//tmp cv=t%tmp ans=cnt*b for i in range(0,cv+1): if i%a==0 or i%b==0: ans+=1 print(ans-1) else: ans=t//a+t//b print(ans)