import Control.Monad.State
 
data Lucas = NewLucas { lucas0 :: Int, lucas1:: Int, lucasP :: Int, lucasQ :: Int }
 
calcLucas :: Lucas -> Int -> Int
calcLucas lucas 0 = lucas0 lucas
calcLucas lucas 1 = lucas1 lucas
calcLucas lucas n = p * lucas (n - 1) - q * lucas (n - 2)
  where
    p = lucasP lucas
    q = lucasQ lucas
 
main :: IO ()
main = do
  n <- readLn 
  print . calcLucas $ NewLucas { lucas0 = 2, lucas1 = 1, lucasP = 1, lucasQ = -1 }
 