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

public class bigsum_aa_slow {
	public static void main(String[] args) {
		new bigsum_aa_slow().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 ans = 0;
		for (long i = 1; i * i <= n; i++) {
			if (n % i == 0) {
				for (long j = 1; j <= n; j++) {
					ans += gcd(i, j);
				}
				long k = n / i;
				if (k > i) {
					for (long j = 1; j <= n; j++) {
						ans += gcd(k, j);
					}
				}
			}

		}
		out.println(ans);
	}

	private long gcd(long a, long b) {
		while (b != 0) {
			long t = a % b;
			a = b;
			b = t;
		}
		return a;
	}
}
