class NemiLib
  # 素因数分解ハッシュ形式
  # (例)100なら{2=>2,5=>2}
  def prime_factorization(num, result = Hash.new(0))
    return {} if num < 1
    return {1=>1} if num == 1

    divides = false
    to = Math.sqrt(num).floor
    (2..to).each_with_index do |item, i|
      if num % item == 0
        result[item] += 1
        prime_factorization(num / item, result)
        divides = true
        break
      end
    end
    # 何も割れないなら、その数を入れる
    result[num] += 1 unless divides

    result
  end
end

s = gets.to_i

# 1:0,0
# 2:x軸上、x,0
# 3:y軸上、0,y
x,y=0,0
#sqrt = Math.sqrt(s).floor
# 最大値対策
# if sqrt == Math.sqrt(s)
#   puts [0,0,sqrt,0,0,sqrt].join(' ')
#   exit
# end

pf = NemiLib.new.prime_factorization(s)
sorted = pf.keys.sort{|a,b|b<=>a}
puts pf.to_s
x = 1
y = 1
count = 0
sorted.each do |key|
  val = pf[key]
  1.upto(val) do |nn|
    count += 1
    if count % 2 == 0
      x *= key
      #puts x
    else
      y *= key
      #puts y
    end
  end
end

puts [0,0,x,0,0,y].join(' ')