let rec floor_sqrt acc acc_x_2_x_r sq_acc_minus_z r sq_r =
  if r = 0 then acc
  else
    let sq_acc_minus_z' = sq_acc_minus_z + acc_x_2_x_r + sq_r in
    ( if sq_acc_minus_z' <= 0 then
        floor_sqrt (acc + r) ((acc_x_2_x_r lsr 1) + sq_r) sq_acc_minus_z'
      else
        floor_sqrt acc (acc_x_2_x_r lsr 1) sq_acc_minus_z) (r lsr 1) (sq_r lsr 2)
let floor_sqrt z = floor_sqrt 0 0 (~-z) (1 lsl 30) (1 lsl 60)

let ceil_sqrt n =
  let m = floor_sqrt n in
  if n <= m * m then m else m + 1

let () = Scanf.scanf "%d" @@ fun s ->
  let x1 = ceil_sqrt s in
  Printf.printf "0 0 %d %d 1 %d" x1 (x1 * x1 - s) x1

