package main
import (
"bufio"
"fmt"
"os"
)
func main() {
in := bufio.NewReader(os.Stdin)
var n int64
fmt.Fscan(in, &n)
current := n
sum := n
temp := n
for temp%2 == 0 {
temp /= 2
current /= 2
sum += current
}
for p := int64(3); p*p <= temp; p += 2 {
for temp%p == 0 {
temp /= p
current /= p
sum += current
}
}
if temp > 1 {
current /= temp
sum += current
}
fmt.Print(sum)
}