import java.math.BigInteger; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static long gcd(long a, long b){ return b == 0 ? a : gcd(b, a % b); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final long N = sc.nextLong(); final long max = N % 2 != 0 ? N : N / 2; //System.out.println(max); final long sqrt = (long)(Math.floor(Math.sqrt(max))); long answer = 0; for(long div_fst = 1; div_fst <= sqrt; div_fst++){ if(max % div_fst != 0) { continue; } final long div_snd = max / div_fst; if(div_fst > div_snd){ break; } //System.out.println(div_fst + " " + div_snd); answer += div_fst; if(div_fst < div_snd){ answer += div_snd; } } System.out.println(answer); } }