package yukicoder; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().solver(); } final long MOD = 1000000007; void solver() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); if (N == 1 || N == 2) { System.out.println(0); return; } long[] c = new long[N + 2]; c[0] = 1; c[1] = 2; c[2] = 1; long[] dp = new long[N + 1];// dp[i]:N=iの時の門松列の数 dp[1] = 1; dp[2] = 2; for (int i = 2; i < N; i++) { for (int j = 0; j <= i; j++) { long d = 1; if ((i - j) != 0 && (i - j) != 1) { d *= dp[i - j] / 2; d %= MOD; } if (j != 0 && j != 1) { d *= dp[j] / 2; d %= MOD; } d *= c[j]; d %= MOD; dp[i + 1] += d; dp[i + 1] %= MOD; if (dp[i + 1] < 0 || c[j] <= 0) { throw new AssertionError("error"); } } for (int j = i + 1; j >= 0; j--) { if (j != 0) { c[j] = c[j] + c[j - 1]; } else { c[j] = 1; } c[j] %= MOD; if (c[j] < 0) throw new AssertionError(); } } System.out.println(dp[N]); sc.close(); } }