let memoize n f =
  let dp = Hashtbl.create n in
  let rec get x =
    try Hashtbl.find dp x with
    | Not_found ->
        let result = f get x in
        Hashtbl.add dp x result;
        result in
  get

let primes = memoize 55555 (fun primes -> function
  | 0
  | 1 -> []
  | 2 -> [2]
  | n ->
      primes (int_of_float @@ ceil @@ sqrt @@ float_of_int n)
      |> List.exists (fun p -> n mod p = 0)
      |> function
        | true -> primes (n - 1)
        | false -> n :: primes (n - 1))

let rec take n = function
  | [] -> []
  | x :: xs ->
      if n = 0 then []
      else x :: take (n - 1) xs

let () = Scanf.scanf "%d\n" @@ fun n ->
  primes 55555
  (*
   * (5i + 1) + (5j + 1) + (5k + 1) + (5l + 1) + (5m + 1) 
   * = 5 (i + j + k + l + m + 1)
   *)
  |> List.filter (fun p -> p mod 5 = 1)
  |> take n
  |> List.iter (Printf.printf "%d ")