Problem:
 Score : 400 points    Problem Statement Given is an integer S .
Find a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:   0 \leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \leq 10^9  The area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2 .   We can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.      Constraints  1 \leq S \leq 10^{18}  All values in input are integers.         Input Input is given from Standard Input in the following format:  S       Output Print six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.
If multiple solutions exist, any of them will be accepted.        Sample Input 1 3      Sample Output 1 1 0 2 2 0 1  The area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2 .
Printing 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.       Sample Input 2 100      Sample Output 2 0 0 10 0 0 10       Sample Input 3 311114770564041497      Sample Output 3 314159265 358979323 846264338 327950288 419716939 937510582

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    S = int(input())

    x1 = 0
    y1 = 0

    if S <= 10**9:
        x2 = 1
        y2 = 0
        x3 = 0
        y3 = S
    elif S == 10**18:
        x2 = 10**9
        y2 = 0
        x3 = 0
        y3 = 10**9
    else:
        x2 = 10**9
        y2 = 1
        y3 = S // 10**9 + 1
        x3 = 10**9 * y3 - S

    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


if __name__ == '__main__':
    main()

Solution (Python):
S = int(input())

sqrtS = int(S**0.5)
if sqrtS**2 < S:
    sqrtS+=1











diff = sqrtS**2-S



x0,y0 = (0,0)
if diff == 0:
    x1,y1 = (0,sqrtS)
    x2,y2 = (sqrtS,0)
else:
    x1,y1 = (diff,sqrtS)
    x2,y2 = (sqrtS, 1)

print(x0,y0,x1,y1,x2,y2)

Solution (Python):
S=int(input());d=10**9;b=(-S)%d;a=S//d+(b>0);print(0,0,a,b,1,d)

Solution (Python):
import sys

s= int(sys.stdin.readline())

t = 10**9
r= s%t
if r==0:
    x3 = 0
    y3 = s//t
else:
    x3 = t - s%t
    y3 = s//t + 1

print( 0,0,t,1,x3,y3 )

Solution (Python):
import math
S = int(input())
X1 = 0
Y1 = 0
X2 = 10**9
Y2 = 1
X3 = (X2 - S % X2) % X2
Y3 = math.ceil(S/X2)
print(X1, Y1, X2, Y2, X3, Y3)

Solution (Python):
import math
s = int(input())
x1 = 10**9; x2 = 1
y2 = math.ceil(s / 10**9)
if s % 10**9 == 0:
    y1 = 0
else:
    y1 = 10**9 - (s % 10**9)
print(0, 0, x1, y1, x2, y2)

Solution (Python):
s = int(raw_input())
x, y = divmod(s, 10 ** 9)
if y:
    x += 1
    y = (10 ** 9) - y
print 0, 0, 10 ** 9, 1, y, x

Solution (Python):
s=int(input())
x1=10**9
y1=1
x2=(x1-s%x1)%x1
y2=(s+x2)//x1
print(0,0,x1,y1,x2,y2)

Solution (Python):
import math
s = int(input())
if (s == 1000000000000000000):
    print(0, 0, 1000000000, 0, 0, 1000000000)
    exit(0)
l = int(math.log10(s))
l1 = l // 2
l2 = l - l1
d = 10 ** max(l1, l2)
b = s % d
a = s // d
print(0, 0, 1, d, a + 1, d - b)

Solution (Python):
import math
s=int(input())
l=10**9
q = math.ceil(s / l)
r = l * q - s 
print(0,0,1,l,q,r)

Solution (Python):
import math
S = int(input())
X1 = 0
Y1 = 0
X2 = 0
Y2 = 0
X3 = 0
Y3 = 0
if  S <= 10 ** 9:
    X2 = S
    Y3 = 1
elif S == 1000000000000000000:
    X2 = int(math.sqrt(S))
    Y3 = X2
else:
    X2 = int(math.sqrt(S) + 1)
    Y3 = X2
    s = X2 ** 2  - S 
    for i in range(1, int(math.sqrt(s) + 1)):
        if s%i == 0 and s//i <= 10 ** 9 and i <= 10 ** 9:
            X3 = i
            Y2 = s//i
            break

print (X1, Y1, X2, Y2, X3, Y3)

Solution (Python):
s=int(input());l=10**9;n=0--s//l;print(0,0,1,l,n,n*l-s)

Solution (Python):
from itertools import count

S = int(input())


def bis(p, ok, ng):
    mid = (ok + ng) // 2
    return (
        ok if abs(ok - ng) == 1 else
        bis(p, mid, ng) if p(mid) else
        bis(p, ok, mid)
    )


R = bis(lambda n: n**2 >= S, 10**9, 0)
(Y1, X2) = (
    (0, 0) if R**2 == S else
    next(
        (Q // x, x)
        for Q in (
            r**2 - S
            for r in count(R)
        )
        for x in range(1, int((Q**0.5) + 1))
        if Q % x == 0 and Q // x <= 10**9
    )
)
ans = '{} {} {} {} {} {}'.format(
    0,
    0,
    R,
    Y1,
    X2,
    R
)

print(ans)

Solution (Python):
m=10**9
s=int(input())
if s%m:
    y=s//m+1
    x=m-s%m
else:
    y=s//m
    x=0
Ans=[0,0,10**9,1,x,y]
print(*Ans)

Solution (Python):
S = int(raw_input())

if S == 10**18:
  print 0,0,10**9,0,0,10**9
  exit(0)

x1 = y1 = 0
x2 = 10**9
y2 = 1
y3 = S/(10**9) + 1
x3 = 10**9 - (S%(10**9))

print x1,y1,x2,y2,x3,y3

Solution (Python):
import math

s = int(input())
sq = math.ceil(math.sqrt(s))
l = map(str, [sq, 1, sq**2-s, sq, 0, 0])
print(" ".join(l))

Solution (Python):
import sys
import math
input = sys.stdin.readline

s = int(input())
if s == 10**18:
    print(0, 0, 0, 10**9, 10**9, 0)
    sys.exit()
t = math.floor(math.sqrt(s))
if t*(t+1) < s:
    x1 = t+1
    y2 = t+1
else:
    x1 = t
    y2 = t+1
x2 = 1
y1 = x1*y2 - s

print(0, 0, x1, y1, x2, y2)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys, math, bisect, random, itertools
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A(s):
    def pri(n, x):
        for i in range(2, int(math.sqrt(n))):
            if n % i == 0 and n // i <= x:
                return [i, n // i]
        return [1, n]
    x = int(math.sqrt(s))
    if s < 10 ** 9:
        print(0, 0, 0, s, 1, 0)
        return
    while 1:
        X = x ** 2
        if X - s < 0:
            x += 1
            continue
        b = pri(X - s, x)
        if b:
            print(0, 0, x, int(b[0]), int(b[1]), x)
            return
        x += 1
    return


def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return




if __name__ == '__main__':
    A(II())

Solution (Python):
import math
import decimal
decimal.getcontext().prec=40

s=int(input())
if s==10**18:
  print(10**9,0,0,10**9,0,0)
else:
  x1,x2,x3,y1,y2,y3=[0,0,0,0,0,0]
  l=decimal.Decimal(s).sqrt()
  if decimal.Decimal(l%1)<0.5:
    x1,y2=int(l),int(l)+1
  else:
    x1,y2=int(l)+1,int(l)+1
  x2=decimal.Decimal(decimal.Decimal(x1*y2)-s)
  y1=1
  print(x1,y1,x2,y2,x3,y3)

Solution (Python):
from decimal import *
getcontext().prec = 100

s = int(input())
s_sqrt = Decimal(s).sqrt()
int_sqrt = int(s_sqrt)
if int_sqrt ** 2 == s:
    print(0,0,int_sqrt,0,0,int_sqrt)
else:
    a = s - int_sqrt ** 2
    b = (int_sqrt+1) ** 2 - s
    if a <= b:
        print(0,1,a,int_sqrt+1,int_sqrt,0)
    else:
        print(0,0,int_sqrt+1,b,1,int_sqrt+1)

Solution (Python):
import math

s = int(input())
sq = math.ceil(math.sqrt(s))
l =map(str, [sq, 1, sq**2-s, sq, 0, 0])
print(" ".join(l))

Solution (Python):
S=int(input())
L=10**9
a=S%L
print('0 0 1 1000000000 '+str((S-a)//L+1)+' '+str(L-a)if S!=L*L else'0 0 0 1000000000 1000000000 0')

Solution (Python):
def solve():
  S = int(input())

  if S == 10 ** 18:
    print('0 0 0 1000000000 1000000000 0')
  else:
    LIMIT = 10 ** 9
    a = S % LIMIT
    b = (S - a) // LIMIT + 1
    c = LIMIT - a
    print('0 0 1 1000000000 ' + str(b) + ' ' + str(c))

solve()

Solution (Python):

seq = {i: 10 ** i for i in range(0, 9+1)}
squared = {index: x ** 2 for index, x in seq.items()}


def sq(number):
    for i, s in squared.items():
        if number <= s:
            return i


def main():
    target = int(input())
    first_e = sq(target)
    first = 10 ** first_e

    if target == squared[first_e]:
        second = first
    else:
        second = (target // seq[first_e]) + 1
    over = first * second
    rest = over - target
    x0 = 0
    y0 = 0
    x1 = first
    y1 = 1
    x2 = rest
    y2 = second
    print(x0, y0, x1, y1, x2, y2)


if __name__ == '__main__':
    main()

Solution (Python):

seq = {i: 10 ** i for i in range(0, 9+1)}
squared = {index: x ** 2 for index, x in seq.items()}


def sq(number):
    for i, s in squared.items():
        if number <= s:
            return i


def main():
    target = int(input())
    first_e = sq(target)
    first = 10 ** first_e

    if target == squared[first_e]:
        second = first
    else:
        second = (target // seq[first_e]) + 1
    over = first * second
    rest = over - target
    x0 = 0
    y0 = 0
    x1 = first
    y1 = 1
    x2 = rest
    y2 = second
    print(x0, y0, x1, y1, x2, y2)


if __name__ == '__main__':
    main()

Solution (Python):
import math

S = int(input())

root_s = math.sqrt(S)
root_si = math.ceil(root_s)

M = root_si
a = 0
if M == root_s:
    b = 0
    c = 0
else:
    flag = False
    while(not flag):
        for bi in range(1, M+1):
            cf = (M*M - S - M*a + a*bi) / bi
            if (cf.is_integer() is True) and (cf <= M):
                flag = True
                b = bi
                c = int(cf)
                break
        if flag is False:
            a = a+1

xylist = [a, 0, M, b, c, M]

output = ''
for i in xylist:
    output = output + str(i) + ' '
print(output)

Solution (Python):
import math
S = int(input())

if S == 10 ** 18:
  print(0, 0, 0, 10 ** 9, 10 ** 9, 0)
  exit()

t = math.floor(math.sqrt(S))
if t * (t + 1) < S:
  x1 = t + 1
  y2 = t + 1
else:
  x1 = t
  y2 = t + 1
x2 = 1
y1 = x1 * y2 - S

print(0, 0, x1, y1, x2, y2)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys, math, bisect, random, itertools
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A(s):
    def pri(n, x):
        if n == 0:
            return [0, 0]
        if n == 1:
            return [1, 1]
        if n == 2:
            return [2, 1]
        for i in range(2, int(math.sqrt(n))):
            if n % i == 0 and n // i <= x:
                return [i, n // i]
        return [1, n]
    x = int(math.sqrt(s))
    if s < 10 ** 9:
        print(0, 0, 0, s, 1, 0)
        return
    while 1:
        X = x ** 2
        if X - s < 0:
            x += 1
            continue
        b = pri(X - s, x)
        if b:
            print(0, 0, x, int(b[0]), int(b[1]), x)
            if x > 10 ** 9 or b[0] > 10 ** 9 or b[1] > 10 ** 9:
                print(s)
                quit()
            return
        x += 1
    return


def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return




if __name__ == '__main__':
    A(II())

Solution (Python):
import numpy as np
s = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
        if len(str(divisors[-1]))<=9:
            break
    return divisors

if s != 1000000000000000000:
    tmp = int(np.ceil(np.sqrt(s)))
    tmp2 = tmp*(tmp) - s
    if tmp2<=1:
        tmp2 = tmp*(tmp+1) - s
        y3 = tmp +1
    else:
        y3 = tmp
    div = make_divisors(tmp2)[-2:]

    x1 = 0
    y1 = 0
    x2 = tmp
    y2 = div[0]
    try:
        x3 = div[1]
    except:
        x3 = div[0]
    if x2==x3 and y2==y3:
        dummy = y2
        y2 = x3
        x3 = dummy
else:
    x1, y1, x2, y2, x3, y3 = 0, 0, 0, 1000000000, 1000000000, 0
    
print(x1, y1, x2, y2, x3, y3)

Solution (Python):
import numpy as np
import math

S = int(input())
A = np.zeros(6)

if S == 10**18:
    A[2] = 10**9
    A[5] = 10**9

else:
    k = math.sqrt(S) + 1
    A[2] = int(k)
    A[5] = int(k)

    A[3] = int(k)**2 - S
    A[4] = 1
    
print(*A.astype(np.int32))

Solution (Python):
S = int(input())

n = int(S**0.5)

if (n+1)**2 <= S:
  n = n+1

if S <= (n-1)**2:
  n = n-1

if S == n**2:
  print(*[0,0,0,n,n,0])
elif S <= n*(n+1):
  x = n*(n+1)-S
  print(*[0,n+1-x,n,n+1,n-1,0])
else: 
  x = (n+1)**2 -S
  print(*[0,n+1-x,n+1,n+1,n,0])

Solution (Python):
S=eval(raw_input())
a=(S+10**9-1)/10**9
b=a*10**9-S

assert a*10**9-b==S
print 0,0,1,10**9,a,b

Solution (Python):
import math
s = int(input())
root = math.ceil(s**0.5)

diff = abs(root**2 - s)

pf=[]
a = 0
b = 0

if diff != 1:
  if diff == 2:
    a = 1
    b = 2
  elif diff == 3:
    a = 1
    b = 3
  else:
    test = int(diff**0.5)+1
    for i in range(2, test):
      




      while diff%i==0:
        pf.append(i)
        diff//=i

    if diff>1:pf.append(diff)
    for i in range(len(pf)):
      if(i%2==0):
        if a ==0:
          a = 1
        a*=pf[i]
      else:
        if b ==0:
          b = 1
        b*=pf[i]
else:
  a = 1
  b = 1
if a != 0 and b == 0:
  b = 1
if b != 0 and a == 0:
  a = 0
if a > 10**9:
  a /= pf[0]
  b *= pf[0]
if b > 10**9:
  a *= pf[0]
  b /= pf[0]

if a >= 0 and b >= 0:
  print("0","0",a,root,root,b)
elif a >= 0 and b < 0:
  print("0",-b,a,root-b,root,0)
elif a < 0 and b >= 0:
  print(-a,"0","0",root,root-a,b)
else:
  print(-a,-b,"0",root-b,root-a,"0")

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    s = int(input())
    ans = [0, 0]
    
    
    
    
    
    
    
    
    x1 = int(('0'*9+str(s))[:-9])+1
    x1 = x1-1 if x1 == 10**9+1 else x1

    
    ans.append(x1)
    ans.append(1)
    ans.append(x1*10**9-s)
    ans.append(10**9)
    print(*ans)
    
    
    
    


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np

S = int(input())

if S == 10 ** 18:
    x1 = int(10**9)
    y1 = 0
    x2 = 0
    y2 = int(10**9)
else:
    k = int(10**9 - S%(10**9))        
    N = int((S - S%10**9)/10**9 + 1)

    x1 = N
    y1 = 1
    x2 = k
    y2 = 10 ** 9

print("0 0 {} {} {} {}".format(x1, y1, x2, y2))

Solution (Python):
import numpy as np

n = int(input())
a1 =0
a2 = 0
b1 = 0
b2 = 0




temp = np.round(np.sqrt(float(n)))
temp = int(temp)
if n == temp*temp:
    a1 = temp
    b2 = temp
    a2 = 0
    b1 = 0
else:
    a1 = temp +1
    b2 = temp +1
    over = a1*b2
    diff = over -n

    if diff > 1e9:
        a1 = temp
        over = a1 * b2
        diff = over - n

    if diff > 1e9:
        b2 = temp
        over = a1 * b2
        diff = over - n
    a2 = 1
    b1 = int(diff)

print("0 0 "+str(a1)+" "+str(a2)+" "+str(b1)+" "+str(b2))

Solution (Python):
s=int(input());l=10**9;n=0--s//l;print(0,0,1,l,n,n*l-s)

Solution (Python):
th = 10 ** 9

S = int(input())

if S <= th:
    print(0, 0, 1, 0, 1, S)
else:
    a = th
    d = -(-S // th)
    b = 1
    c = a * d - S
    print(0, 0, a, b, c, d)

Solution (Python):
import sys
import math

S = int(input())

X1 = 0
Y1 = 0

AA = int(math.sqrt(S))

if AA**2 == S:
    print(0,0,AA,0,0,AA)
    sys.exit()

A = AA+1
B = AA+1

iS = A*A - S

if iS >= A+1:
    B = AA 
    iS = A*B - S

for i in range(1,iS+1):
    if (iS % i) == 0:
        if iS/i <= 10**9:
            a = i
            b = int(iS/i)
            print(X1, Y1, A, a, b, B)
            sys.exit()

Solution (Python):
s = int(input())
l = 0
r = s
while l + 1 < r:
    m = (l + r) // 2
    if m**2 < s:
        l = m
    else:
        r = m
if r**2 == s:
    print("0 0 0 %d %d 0" % (r, r))
elif r**2 - s <= 1e9:
    ds = r**2 - s
    print("0 0 %d 1 %d %d" % (r, ds, r))
else:
    ds = s - (r - 1)**2
    print("0 1 %d 0 %d %d" % (r - 1, ds, r))

Solution (Python):
import numpy as np
import math

S = int(input())
A = np.zeros(6)

if S == 10**18:
    A[2] = 10**9
    A[5] = 10**9
    
else:
    A[2] = int(math.sqrt(S) + 1)
    A[5] = int(math.sqrt(S) + 1)

    A[3] = int(math.sqrt(S) + 1)*int(math.sqrt(S) + 1) - S
    A[4] = 1
    
print(*A.astype(np.int32))

Solution (Python):
import math
import sys
S=int(input())

a=math.sqrt(S)
b=math.ceil(a)
diff = -(S-b**2)
diffs=[]
if diff ==0:
  print(0,0,int(b),0,0,int(b))
  sys.exit()

for i in range(1,math.ceil(math.sqrt(b))+1):
  if diff%i!=0:
    continue
  else:
    diffs.append([i,int(diff/i)])
  if len(diffs)>2:
    if diffs[-2][1]==diffs[-1][0]:
      print(0,0,int(b),int(diffs[-1][0]),int(diffs[-1][1]),int(b))
      sys.exit()
      
print(0,0,int(b),int(diffs[-1][0]),int(diffs[-1][1]),int(b))

Solution (Python):

import sys;
import string;
sys.setrecursionlimit(20000) 

import copy
import math
import itertools

from functools import lru_cache


PPP = 1000000007


n = int(input())






























import re
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def ss(x1, y1, x2, y2):
  print(x1, y1, x2, y2, file=sys.stderr)
  ss2 = x2 * y2 * 2 - x1 * y1 - x2 * (y2 - y1) - (x2 - x1) * y2
  return ss2


MX = 1000000000
def doit(s):
  if s <= MX:
    print(0, 0, 0, 1, s, 0, file=sys.stderr)


  r = int(math.ceil(math.sqrt(s)))
  print(r, file=sys.stderr)
  diff = r ** 2 - s
  print(diff, file=sys.stderr)
  if diff == 0:
    print(r, 0, 0, r, r, r)
    return
    
  for x in range(1,r):
    if diff % x == 0:
      if diff / x <= r:
        print(r-x, 0, 0, int(r-diff/x), r, r)
        return
      
  print(0, 0, 0, 1, s, 0)
  

def yn():
  if doit():
    return "Yes"
  else:
    return "No"




try:
  doit(n)
  
  
except Exception as e:
  print("e", e, file=sys.stderr)

Solution (Python):
s = int(input())
m9 = 10**9

if s <= m9:
  print(0, 0, 0, 1, s, 0)
else:
  if s%m9==0:
    print(0, 0, 0, m9, int(s/m9), 0)
  else:
    res = m9 - (s%m9)
    s += res
    print(0, 0, m9, res, 1, int(s/m9))

Solution (Python):
n=int(input())
if n<=10*9:
    print(*[0,0,n,0,n,1])
    exit()
bc=(-n)%(10**9)
ad=(bc+n)//10**9
print(*[0,0,10**9,1,bc,ad])

Solution (Python):
X = 10 ** 9

S = int(input())

if S < X * X:
	x1 = X
	y2 = (S // x1) + 1
	y1 = 1
	x2 = x1 * y2 - S
else:
	x1 = X
	y2 = X
	x2 = 0
	y1 = 0

print(0, 0, x1, x2, y1, y2)

Solution (Python):
s=int(input())

if s<=10**9:
    print(0,0,s,0,0,1)
else:
    a=s//10**9
    b=s%10**9
    if b!=0:
        x1,y1=10**9-a,10**9
        x2,y2=10**9-a-1,0
        x3,y3=10**9,10**9-b
        print(x1,y1,x2,y2,x3,y3)
    else:
        
        print(10**9-a+1,10**9,10**9-a,0,10**9,0)

Solution (Python):
s=int(input())
x1=int(s**0.5)
y1=0
x2=0
y2=int(s**0.5)
if x1*y2>s:
    x2=(x1*y2)-s
    y1=1
elif x1*y2<s:
    x1+=1
    x2=(x1*y2)-s
    if x2<0:
        y2+=1
        x2=(x1*y2)-s
    y1=1
print(0,0,x1,y1,x2,y2)

Solution (Python):
S = int(input())
xymax = 10 ** 9

add = (xymax - S % xymax) % xymax
tmp = S + add
x1, y2 = tmp // xymax, xymax
x2, y1 = add, 1
print(0, 0, x1, y1, x2, y2)

Solution (Python):
import math
S = int(input())

X2 = math.sqrt(S)
if X2.is_integer():
    print(0, 0, int(X2), 0, 0, int(X2))
else:
    X2 = int(math.floor(X2)) + 1
    Y3 = X2
    print(0, 0, X2, (X2*Y3)-S, 1, Y3)

Solution (Python):
s = int(input())
if s <= 10**9:
	print(0, 0, 1, 0, 0, s)
elif s == 10**18:
	print(0, 0, 10**9, 0, 0, 10**9)
else:
	t = 10**9 - (s%(10**9))
	print(0, 0, 10**9, 1, t, (s+t)//10**9)

Solution (Python):
import numpy as np

def make_divisors(n):
        divisors = []
        for i in range(1, int(n**0.5)+1):
                if n % i == 0:
                        divisors.append(i)
                        if i != n // i:
                                divisors.append(n//i)
        
        return divisors

S = int(input())
ans = []
x1y2 = int(np.sqrt(S))
if x1y2 > (10**9)-10000:
    x1y2 = 10**9
rem = S - x1y2 ** 2
if rem == 0:
        x2 = 0
        y1 = 0
elif rem == 1:
        x2 = 1
        y1 = -1
elif rem < 0:
        comb = make_divisors(-rem) 
        x2 = comb[-1]
        y1 = abs(rem // x2)
        print(0)
        print(0)
        print(x1y2)
        print(y1)
        print(x2)
        print(x1y2)
        exit()
else:
        comb = make_divisors(rem) 
        x2 = comb[-1]
        y1 = -(rem // x2)
print(0)
print(-y1)
print(x1y2)
print(0)
print(x2)
print(x1y2 - y1)

Solution (Python):
n=input()
import math
x=int(math.sqrt(n))
if x*x==n:
    print 0,
    print 0,
    print x,
    print 0,
    print 0,
    print x
    exit()
a=int(math.ceil(math.sqrt(n)))
d=a
cnt=1
while a*d-n<0:
    if cnt&1:
        a+=1
    else:
        d+=1
    cnt+=1
bc=a*d-n
i=1
while i*i<=bc:
    if bc%i==0:
        if bc/i<=10**9 and i<=10**9:
            b=i
            c=bc/b
            print 0,0,a,b,c,d
            exit()

Solution (Python):
S = int(input())
from math import sqrt,ceil

sq = ceil(sqrt(S))

left = S%sq
height = int(S // sq)

Ans = [left,0,0,height,sq,height+1]
if S == 10**18:
    Ans = [0 ,0, 0,1000000000,1000000000,1000000000]
print(*Ans,sep = " ")

Solution (Python):
import math
S=int(input())
ss=math.sqrt(S)
s=math.ceil(ss)
t=s*s-S
if t>10**9:
    for n in range(2,t+1):
        if t%n==0:
            k=n
            break
elif t>0:
    k=1
    print(0,0,s,k,round(t/k),s)
if t==0:
    print(0,0,s,0,0,s)

Solution (Python):
S = int(input())

X1 = 10 ** 9

Y2 = -(-S // X1)

X2 = Y2 * X1 - S

Y1 = 1

print("{} {} {} {} {} {}".format(X1, Y1, X2, Y2, 0, 0))

Solution (Python):
import math
s=int(input())
x1=0
y1=0
x2=int(math.sqrt(s))+1
x3=0
y2=0
y3=x2

if (x2-1)*(y3-1)==s:
    print(" ".join([str(x1),str(y1),str(x2-1),str(y2),str(x3),str(y3-1)]))
    exit()

else:
    x3=(x2-x1)*(y3-y1)-s
    y2=1
    ans=abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))
    print(" ".join([str(x1),str(y1),str(x2),str(y2),str(x3),str(y3)]))

Solution (Python):
S = int(input())

n1 = S
n2 = 1

if n1 < 10 ** 9:
    print(0, 0, 1, 0, 0, n1)
elif n1 == 10 **18:
    print(0, 0, 10**9, 0, 0, 10**9)
else:
    a = n1 // (10 ** 9) + 1
    d = 10 ** 9
    b = (10 ** 9) - n1 % (10 ** 9)
    c = 1
    print(0, 0, a, b, c, d)

Solution (Python):
ps = [2]
for i in range(3, int(1e9**0.5)):
    n = i
    for p in ps:
        if n % p == 0:
            n //= p
            break
    if n == i:
        ps.append(n)



def f(s):
    if s == 0:
        return (0, 0)
    a = s
    b = 1
    i = 0
    while i < len(ps):
        if a <= 1e9 and b <= 1e9:
            break
        p = ps[i]
        if a % p == 0 and 1e9 < b * p:
            break
        if a % p == 0:
            a //= p
            b *= p
        else:
            i += 1
    return (a, b)

s = int(input())

l = 0
r = s
while l + 1 < r:
    m = (l + r) // 2
    if m ** 2 < s:
        l = m
    else:
        r = m
ds = r**2 - s

a, b = f(ds)
print("0 0 %d %d %d %d" % (r, a, b, r))

Solution (Python):
import math
from collections import Counter

s = int(input())

def primes(n) :
    ps = [2]
    for i in range(3, n+1) :
        for p in ps :
            if i%p == 0 :
                break
        else :
            ps.append(i)
    return ps

def factorint(n) :
    ps = primes(n)
    l = []
    while n != 1 :
        for p in ps :
            if n%p == 0 :
                n //= p
                l.append(p)
                break
    return Counter(l)

a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)

Solution (Python):
s = int(input())
if s<=10**9:
	print(0,0,1,0,0,s)
elif 10**18>s>10**9:
    q,r = divmod(s,10**9)
    print(10**9,0,r,q+1,0,1)
else:
    print(0,0,10**9,0,0,10**9)

Solution (Python):


import math
import sys

s = int(input())

a1 = int(math.sqrt(s))
if 0 < s - a1**2:
    a1 += 1

b2 = (s + a1 - 1) // a1

rest = a1 * b2 - s

if rest == 0:
    print(0, 0, a1, 0, 0, b2)
else:
    a2 = 1
    b1 = rest
    print(0, 0, a1, a2, b1, b2)

Solution (Python):
S = int(input())
if S <= 10**9:
    print(0,0,S,0,0,1)
elif S == 10**18:
    print(0,0,10**9,0,0,10**9)
else:
    xb = int(S**0.5 + 1)
    yc = int(S**0.5 + 1)
    xc = xb*yc - S
    print(0, 0, xb, 1, xc, yc)

Solution (Python):






s = int(input())
s_str = str(s)
order = len(s_str)

tmp_list = [s_str[i] for i in range(len(s_str))]
if set(tmp_list) == set(["0","1"]):
    if len(s_str) <= 10:
        a = s
        b = 1
        c = 1
        d = 0
    else:
        a = 10**9
        b = 10**(len(s_str)-10)
        c = 1
        d = 0
elif len(s_str) >= 10:
    a = int(s_str[:9]) +1
    b = 10**(len(s_str) - 9)
    c = 10**(len(s_str[9:])) - int(s_str[9:])
    d = 1
else:
    a = int(s_str)
    b = 1
    c = 1
    d = 0

print('0 0 ' + str(a) + ' ' + str(d) + ' ' + str(c) + ' ' + str(b))

Solution (Python):

S=input()
X3=0
X1=""
Y1=0
Y2=""
Y3=""
if int(S)==10**18:
    X1=0
    Y3=10**9
    X2=10**9
    Y2=0
elif len(S)>9:
    for i in range(0,len(S)-9):
        X1=X1+S[i]
    Y2=10**9
    for j in range(len(S)-9,len(S)):
        Y3=Y3+S[j]
    Y3=int(Y3)
    X1=int(X1)
    X2=X1+1
else:
    Y2=0
    X2=int(S)
    Y3=1
    X1=0

print(X1,Y1,X2,Y2,X3,Y3)

Solution (Python):
import math
import random

cands=[2*x+3 for x in range( int(10**4.5)+1 )]
primes=[2]
while(1):
    y=cands.pop(0)
    primes.append(y)
    cands=[x for x in cands if x%y!=0]
    if y>cands[-1]**0.5:
        break
primes=primes+cands

S=int(input())

X=math.ceil(S**0.5)
Y=X
sol=0
if X**2==S:
    print(0,0,X,0,0,X)
else:    
    while(sol==0):
        ab=X*Y-S
        cc=[1,1,0]
        t=0
        XX=ab
        XY=[X,Y,10**19]
        for p in primes:
            while( XX%p==0):
                XX//=p
                cc[t]*=p
                if cc[t]>XY[0]:
                    t+=1
                    cc[t-1]//=p
                    cc[t]*=p
            if cc[0]>X or cc[1]>Y:
                sol=2
                break
            elif XX==1:
                sol=1
                break
        if cc[0]>cc[1]:
            cc[1]*=XX
        else:
            cc[0]*=XX
        if cc[0]<X and cc[1]<Y:
            sol=1
        if sol==1:
            print(0,0,Y,cc[0],cc[1],X)
        elif sol != 1:
            X+=1
            Y+=1
            sol=0

Solution (Python):
import math
s = int(input())
sq = math.ceil(math.sqrt(s))
print(0, 0, sq, 1, sq**2 - s, sq)

Solution (Python):
import math
s = int(input())

root = math.ceil(math.sqrt(s))

if s <= 10 ** 9:
  print(0,0,0,1,s,0)
else:
  tmp = root**2 - s
  print(0,0,tmp,root,root,1)

Solution (Python):
S = int(input())
 
if S <= 10**9:
  print(0,0,S,0,0,1)
elif S == 10*18:
  print(0,0,10**9,0,0,10**9)
  end
else:
  q,r = divmod(S,10**9)
  if r == 0:
    print(0,0,0,10**9,q,0)
  else:
    print(0,0,1,10**9,q+1,10**9-r)

Solution (Python):

S = int(input())


num = len(str(S))

min_num = 10**9

if S!=10**18:
    X1=0
    Y1=0

    X2 = S // min_num +1
    Y2 = X2*min_num - S

    X3 = 1
    Y3  = min_num

else:
    X1=0
    Y1=0

    X2 =10**9
    Y2 = 0

    X3 = 1
    Y3  = 10**9


print("{} {} {} {} {} {}".format(X1, Y1, X2, Y2, X3, Y3))

Solution (Python):
s = int(input())

x1 = 0
y1 = 0
x2 = int(s ** 0.5)
y3 = -(-s // x2)
x3 = 1
if y3 > 10 ** 9:
    x2 += 1
    y3 = -(-s // x2)
y2 = x2 * y3 - s
print(x1, y1, x2, y2, x3, y3)

Solution (Python):
import math

s = int(input())
rs = math.ceil(math.sqrt(s))
d = rs**2 - s

print(0, 0, rs, d, 1, rs)

Solution (Python):
s=int(input())
sqr=int((s-1)**(1/2))+1
sa=sqr**2-s
if(sqr>10**9):
    sa=10**18-s
    print(0,0,10**9,1,sa,10**9)
else:
 	print(0,0,sqr,1,sa,sqr)

Solution (Python):

import sys
import math


def myinput_int():
    return list(map(int, input().split()))

S, = myinput_int()

if S<=1000000000 :
    print('0 0 1 0 0',S)
    exit(0)


a = math.ceil(math.sqrt(S))
temp = a*a-S

print('0 0 {:d} {:d} {:d} {:d}'.format(a, 1, temp, a))

Solution (Python):
import math
S = int(input())

rootS = math.ceil(math.sqrt(S))

a = rootS
b = rootS
c = (rootS*rootS) - S

print("0 0 {} {} {} {}".format(a, c, 1, b))

Solution (Python):
S = int(input())
r = int(S**(1/2))
d = S-r**2

X1 = r
Y1 = 0
X2 = 0

Y2_tmp = r - ((r+1)**2 - r**2 - (d+1))

if d == 0:
    Y2 = r
elif Y2_tmp < 1:
    Y2 = 1
else:
    Y2 = r - ((r+1)**2 - r**2 - (d+1))


if d == 0:
    Y3 = r
else:
    Y3 = r+1


if d == 0:
    X3 = r
elif d < r+1:
    X3 = d
else:
    X3 = r+1

print(X1, Y1, X2, Y2, X3, Y3)

Solution (Python):
s = int(input())
k = len(str(s))-1
x1 = 0
y1 = 0
x2 = 0
y2 = 0
if k >= 10:
    x1 = 10**9
    if s%x1 == 0:
        y2 = int(s//x1)
    else:
        y2 = int(s//x1)+1
    x2 = x1*y2-s
    y1 = 1
else:
    x1 = s
    y2 = 1

print(0,0,x1,y1,x2,y2)

Solution (Python):

N = 10**9
S = int(input())
x1 = (S // N) + 1
y2 = N
x2 = 1
y1 = (x1*y2) - S
if S == 10**18:
    x1 = N
    y2 = N
    x2 = 0
    y1 = 0
print (" ".join(map(str,[x1,y1,x2,y2,0,0])))

Solution (Python):
s = int(input())
m = int(s**0.5)

l = s - m*m
if l<0:
    m = m-1
    l = s - m*m



if l < 1000000000 and m < 1000000000:
    print(0,1,m,0,l,m+1)
    
elif m == 1000000000:
    print(0,0,m,0,0,m)
else:
    l = (m+1)*(m+1)-s
    if l < 1000000000:
        print(0,0,m+1,1,l,m+1)
    else:
        for i in range(2,int(l**0.5) +1):
            if l%i == 0:
                t =i
                break
        print(0,0,m+1,t,l//t,m+1)

Solution (Python):
S=int(input())
X1=0
Y1=0
flag=True
if S<=10**9:
    X2=0
    Y2=1
    X3=S
    Y3=0
elif S%10**9==0:
    X2=0
    Y2=S//10**9
    X3=10**9
    Y3=0
else:
    t=S%(10**9)
    A=10**9-t
    v=(S+A)//10**9
    
    K=A
    if A<=10**9:
        X2=1
        Y3=A
        flag=False
        
    if flag:
        while A%2==0:
            A//=2
            if A<=10**9:
                X2=K//A
                Y3=A
            
        i=3
        while True:
            if A%i==0:
                A//=i
                if A<=10**9:
                    X2=K//A
                    Y3=A
                    break
                
            else:
                i+=2
    
    X3=10**9
    Y2=v
    
L=[X1,Y1,X2,Y2,X3,Y3]
print(" ".join([str(x) for x in L]))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = INT()

def make_divisors(n):
	for i in range(floor(n**0.5), 0, -1):
		if n % i == 0:
			if i <= 10**9 and n//i <= 10**9:
				return i

			if i != n // i:
				if n//i <= 10**9 and S//(n//i) <= 10**9:
					return i

a = ceil(S**(1/2))
b = ceil(S**(1/2))
if a * b == S:
	c = d = 0
else:
	c = make_divisors(a*b-S)
	if c == 0:
		c = d = 0
	else:
		d = ((a*b)-S)//c
print(0, 0, a, d, c, b)