let rec lucas = function
  | 0 -> (2, 1)
  | n ->
      let (l_n_2, l_n_1) = lucas (n - 1) in
      (l_n_1, l_n_1 + l_n_2)

let () = Scanf.scanf "%d" (fun n ->
  Printf.printf "%d\n" @@ fst @@ lucas n)