import scala.io.StdIn.readInt;
object Main {
    def main(args: Array[String]): Unit = {
        println(fibonacci(readInt));
    }
    def fibonacci(n: Int): Int = {
        def _fibonacci(cnt: Int, list: List[Int]): Int = {
            if (cnt < 0) list.head;
            else list match {
                case x1 :: x2 :: xs => _fibonacci(cnt - 1, (x1 + x2) :: list);
                case _ => _fibonacci(cnt - 1, 1 :: list);
            }
        }
        _fibonacci(n, Nil);
    }
}
