import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); long[][] DP = new long[4][N + 1]; for(int step = 1; step <= Math.min(3, N); step++){ DP[step][step] = 1; } for(int pos = 1; pos < N; pos++){ for(int prev_step = 1; prev_step <= 3; prev_step++){ for(int step = 1; step <= 3; step++){ if(prev_step == step){ continue; } final int next_pos = pos + step; if(next_pos > N){ break; } DP[step][next_pos] += DP[prev_step][pos]; DP[step][next_pos] %= MOD; } } } long sum = 0; for(int i = 1; i <= 3; i++){ sum += DP[i][N]; sum %= MOD; } System.out.println(sum); } }