import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long mod = (long)Math.pow(10,9)+7; long [][] num = new long [1000001][4]; num[1][1] = 1; num[2][2] = 1; num[3][1] = 1; num[3][2] = 1; num[3][3] = 1; for(int i=4; i<=N; i++){ num[i][1] = num[i-1][2]+num[i-1][3]; num[i][2] = num[i-2][1]+num[i-2][3]; num[i][3] = num[i-3][1]+num[i-3][2]; for(int j=0; j<3; j++){ num[i][j]%=mod; } } long ans=0; for(int i=1; i<=3; i++){ ans+=num[N][i]; } System.out.println(ans%mod); } }