q = 10^9+7 apply n f x = foldr ($) x (replicate n f) main = readLn >>= print . step step :: Int -> Int step 1 = 1 step 2 = 1 step 3 = 2 step n = head $ apply (n-4) (\(x1:x2:_) -> mod (x1+x2) q : [x1,x2]) [3,2,1,1]