class Yukicoder KEN = 0 PAR = 1 KENKEN = 2 MOD = 10 ** 9 + 7 def initialize n = gets.chomp.to_i dp = Array.new(n+1){ Array.new(3, 0)} dp[1][KEN] = 1 2.upto(n) do |i| dp[i][KEN] = dp[i-1][PAR] dp[i][PAR] = dp[i-1][KEN] + dp[i-1][KENKEN] dp[i][KENKEN] = dp[i-1][KEN] end puts dp[n].inject(:+) % MOD end end Yukicoder.new