MOD = 1e9.to_i + 7 N = gets.to_i dp = Array.new(N + 1) { [0] * 4 } dp[0][0] = 1 N.times do |i| 4.times do |j| 1.upto(3) do |k| dp[i + k][k] = (dp[i + k][k] + dp[i][j]) % MOD if i + k <= N && j != k end end end puts (dp[N].inject :+) % MOD