MOD = 1000000007 n = gets.to_i dp1 = Array.new(n+4,0) dp2 = Array.new(n+4,0) dp3 = Array.new(n+4,0) dp1[1] = 1 dp2[2] = 1 dp3[3] = 1 1.upto(n-1){|i| dp1[i+1] = (dp1[i+1]+dp2[i]+dp3[i])%MOD dp2[i+2] = (dp2[i+2]+dp1[i]+dp3[i])%MOD dp3[i+3] = (dp3[i+3]+dp1[i]+dp2[i])%MOD } p (dp1[n]+dp2[n]+dp3[n])%MOD