n=int(input()) if 1<=n<=3*10**5: pass else: raise Exception ans=0 for i in range(2,3*10**5+1): if n%i==0: while n%i==0: ans+=i n//=i print(ans)