n = gets.to_i m = 10**9 + 7 memo = [1, 2, 2] (4..n).each { |i| memo.push((memo[i - 3] + memo[i - 4]) % m) } if n >= 4 p memo[n - 1]