require 'pp'
require 'prime'
s = gets.to_i
x1 = y1 = 0
x2 = y2 = 0
x3 = y3 = 0


arr = [[1,1]] + s.prime_division

arr2 = arr.flat_map{|(a,b)|[a] * b}
# p arr2
arr3 = []

(arr2.size - 1).times do |i|
  # p arr2[0..i]
  # p arr2[(i+1)..-1]

  arr3 << [
    arr2[0..i].inject(:*),
    arr2[(i+1)..-1].inject(:*)
  ]
end

x = arr3.find{|(a,b)|a <= 10**9 && b <= 10**9}
puts '0 0 0 ' + x[0].to_s + ' ' + x[1].to_s + ' 0'

# 314159265 358979323 846264338 327950288 419716939 937510582

#### 311114770564041497
# => 311114770564041497
