program triangle
  implicit none
  integer(8) :: s, h, w, a, b, d
  integer(8) :: x1, y1, x2, y2, x3, y3, i
  read(*,*) s
  x1 = 0_8
  y1 = 0_8
  h = int(ceiling(sqrt(real(s,8))),8)
  w = h
  d = h*w-s
  a = 0_8
  b = 0_8
  if (d > 0_8) then
    a = int(floor(sqrt(real(d,8))),8)
    do while (a < d)
      if (mod(d,a) == 0_8) exit
      a = a+1_8
    end do
    b = d/a
  end if
  x2 = a
  y2 = h
  x3 = w
  y3 = b
  write(*,'(i0,x,i0,x,i0,x,i0,x,i0,x,i0)') x1, y1, x2, y2, x3, y3
  stop
end program triangle