open Batteries
let () =
  let n = Scanf.scanf "%d " (fun a -> a) in

  let n_bonacci nn n =
    let rec fib_aux n res prevs =
      if n <= 0 then (prevs, 0) else
      if n = 1 then (prevs, res)
      else 
        let tl = List.tl prevs in
        let sum = List.fold_left (+) 0 prevs in
        fib_aux (n-1) (res+sum) (tl @ [res])
    in
    let n = n-nn+1 in
    fib_aux n 1 [2]
  in
  let lucas = n_bonacci 1 in
  let _, ans = lucas n in

  Printf.printf "%d\n" ans
