// Arup Guha
// Started 3/1/2018, finished 3/9/2018
// Solution to 2018 February Platinum Problem: Cow Gymnasts

import java.util.*;
import java.io.*;

public class gymnasts {

	final public static long MOD = 1000000007L;

	public static void main(String[] args) throws Exception {

		// Read the grid.
		Scanner stdin = new Scanner(new File("gymnasts.in"));

		// Read and solve.
		long n = stdin.nextLong();
		long res = solve(n);

		// Ta da!
		PrintWriter out = new PrintWriter(new FileWriter("gymnasts.out"));
		out.println(res);
		out.close();
		stdin.close();
	}

	public static long solve(long n) {

		// Get all divisors except 1 and n, then sort.
		ArrayList<Long> div = new ArrayList<Long>();
		for (long d=2; d*d<=n; d++) {
			if (n%d == 0) {
				div.add(d);
				if (d < n/d) div.add(n/d);
			}
		}
		Collections.sort(div);

		// Order from largest to smallest.
		Collections.reverse(div);

		// Pre-count all settings (1,1,...) to (n,n,n...)
		long res = n%MOD;

		// Stores how many times each divisor is the gcd of n and each number from 1 to n.
		long[] cnt = new long[div.size()];

		// Go through each divisor from largest to smallest.
		for (int i=0; i<div.size(); i++) {

			// We don't count when this divisor divides into n.
			long times = n/div.get(i) - 1;

			// Subtract out all of the times a larger divisor divided into these numbers also.
			for (int j=0; j<i; j++)
				if (div.get(j)%div.get(i) == 0)
					times -= cnt[j];

			cnt[i] = times;

			// We want to count all arrangements of the x and x+1 except all xs and all x+1s.
			// This is why we have -2. Times is for each different number for which this is the case.
			res = (res + (times%MOD)*(modExp(2L, div.get(i)) + MOD - 2))%MOD;
		}

		return res;
	}

	// Regular fast mod expo...
	public static long modExp(long base, long exp) {

		if (exp == 0) return 1L;

		if (exp%2 == 0) {
			long tmp = modExp(base, exp/2);
			return (tmp*tmp)%MOD;
		}
		return (base*modExp(base, exp-1))%MOD;
	}
}