import java.util.Scanner;
public class A740{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext())
System.out.println(calcu(sc.nextInt()));
}
public static int calcu(int num){
int sum = 0;
for(int i = 2; i <= num; i++){
while(num % i == 0){
num /= i;
sum += i;
}
}
return sum;
}
}