import java.io.*;
import java.util.*;
import java.math.*;

public class bigsum_aa {
	public static void main(String[] args) {
		new bigsum_aa().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	void myAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	long inBounds(long x, long l, long r, String name) {
		myAssert(l <= x && x <= r, name + " is not in bounds: " + x
				+ " not in [" + l + ", " + r + "]");
		return x;
	}

	String FNAME = "bigsum";

	long BOUND = (long) 1e12;

	private void solve() throws IOException {
		long n = inBounds(nextLong(), 1, BOUND, "n");
		long nn = n;
		primes = new ArrayList<Long>();
		ArrayList<Integer> powers = new ArrayList<Integer>();
		for (long i = 2; i * i <= n; i++) {
			if (n % i == 0) {
				int k = 0;
				while (n % i == 0) {
					n /= i;
					k++;
				}
				primes.add(i);
				powers.add(k);
			}
		}
		if (n > 1) {
			primes.add(n);
			powers.add(1);
		}
		a = new long[primes.size()][];
		pow = new long[a.length][];
		for (int i = 0; i < a.length; i++) {
			a[i] = new long[powers.get(i) + 1];
			a[i][0] = 1;
			long p = primes.get(i);
			pow[i] = new long[a[i].length];
			pow[i][0] = 1;
			for (int j = 1; j < pow[i].length; j++) {
				pow[i][j] = pow[i][j - 1] * p;
			}
			for (int j = 1; j < a[i].length; j++) {
				a[i][j] = p * a[i][j - 1] + pow[i][j] - pow[i][j - 1];
			}
		}
		bf(1, 1, 0, nn);
		out.println(ans);
	}

	long[][] a, pow;
	long ans = 0;
	ArrayList<Long> primes;

	private void bf(long d, long g, int i, long n) {
		if (i >= a.length) {
			ans += n / d * g;
			return;
		}
		for (int j = 0; j < a[i].length; j++) {
			bf(d, g * a[i][j], i + 1, n);
			d *= primes.get(i);
		}
	}

//	long g(long[] p, int[] q) {
//		long ans = 1;
//		for (int i = 0; i < q.length; i++) {
//			ans *= gpq(p[i], q[i]);
//		}
//		return ans;
//	}
//
//	long gpq(long p, int k) {
//		long[] pow = new long[k + 1];
//		pow[0] = 1;
//		for (int i = 1; i < pow.length; i++) {
//			pow[i] = pow[i - 1] * p;
//		}
//		long ans = 0;
//		for (int i = 1; i < k; i++) {
//			ans += pow[i] * (pow[k - i] - pow[k - i - 1]);
//		}
//		return ans;
//	}
//
//	private long gcd(long a, long b) {
//		while (b != 0) {
//			long t = a % b;
//			a = b;
//			b = t;
//		}
//		return a;
//	}
}
