#include<iostream>
using namespace std;
int gcd(int a, int b);
int total(int num,int sum);
int main() {
cin.tie(0), cin.sync_with_stdio(false);
int num, sum = 0;
while (cin >> num) {
int answer = total(num,sum);
cout << answer << endl;
}
return 0;
}
int total(int num,int sum) {
int i = 2;
while (num != i) {
if (num % i == 0 && num != i) {
int result = gcd(num, i);
if (result == 1) {
sum += i;
num /= i; //num除掉因數後,繼續遞歸,直到num==i為止
i = 2; //重製i值
}
}
i++;
}
return sum + i;//回傳最後的總和
}
int gcd(int a, int b) {
while (b != 0) { //當餘數不為0時
int temp = a % b;
a = b;
b = temp;
}
if (a == 1)return 0; //當餘數為0且不互質
else return 1; //當餘數為0且互質
}