import java.util.*;
public class Main {
static Scanner scn = new Scanner(System.in);
public static void main(String[] args) {
int n = scn.nextInt();
int p = 1000000007;
int ans = power(n, p - 2, p);
System.out.println(ans);
}
public static int power(int a, int n, int m) {
a = a % m;
if (n == 1)
return a;
int ans = power(a, n / 2, m) % m;
ans = (ans * ans) % m;
if (n % 2 == 0)
return ans;
else
return (ans * a) % m;
}
}