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 math
def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

S = int(input())
x = int(math.ceil(math.sqrt(S)))
Z = x * x - S

if Z == 0:
    z = 0
    oz = 0
else:
    fs = factorize(Z)
    z = 1
    oz = 1
    for k, c in fs:
        while c >= 2:
            z *= k
            oz *= k
            c -= 2
        if c > 0:
            if z < oz:
                z *= k
            else:
                oz *= k




print("0 0 {} {} {} {}".format(x, z, oz, x))

Solution (Python):
s = input()

print("0 0 ", end = "")

if int(s) <= 10**9:
  print(s + " 0 0 1")
else:
  
  u = int(s[0:len(s)-9])
  
  if u*10**9 == int(s):
    print(str(u) + " 0 0 " + str(10**9), end = "")
  else:
    print(str(u+1) + " 1 ", end = "")
    nokori = (u+1)*(10**9) - int(s)
    print(str(nokori) + " " + str(10**9))

Solution (Python):
s = int(input())
if s <= 10**9:
    print('1', '0', '0', str(s), 0, 0)
else:
    if s % 10**9 == 0:
        print(s//10**9, 0, 0, 10**9, 0, 0)
    else:
        about = s // 10**9 + 1
        amari = s % 10**9
        print(10**9-amari, about, 10**9, 1, 0, 0)

Solution (Python):
import math
N = int(input())
k = 10**9
l = ['0','0']
if N<k:
    l = l + ['0','1']
    l.append(str(N))
    l.append('0')
else:
    m = math.ceil(N / k)
    M = N % k
    if M==0:
        l = l + [str(k),'0']
    else:
        l = l + [str(k),'1']
    s = N % k
    x_2 = k - s
    l.append(str(x_2))
    l.append(str(m))
print(' '.join(l))

Solution (Python):
from math import *
import itertools

S = int(input())
T = 10**9

M = S % T

a = 1
b = (T - M) % T
x = 10**9
y = (S + a*b)/x

X3 = x
Y2 = y
X2 = a
Y3 = b

print('0 0 ' + str(int(X2)) + ' ' + str(int(Y2)) + ' ' + str(int(X3)) + ' ' + str(int(Y3)))

Solution (Python):
import math

S = int(input())
X = [0,0,0]
Y = [0,0,0]
ans = []

s = math.sqrt(S)
if S <= 10**9:
    X[1] = 1
    Y[2] = S
elif S <= 10**12:
    for x in range(math.ceil(s)):
        if S % x == 0 and x * 10**9 >= S:
            X[1] = x
            Y[2] = int(S//x)
else:
    X[1] = math.ceil(s)
    Y[2] = math.ceil(s)

    d = X[1]*Y[2] - S
    X[2] = 1
    Y[1] = d

for i in range(3):
    ans.append(str(X[i]))
    ans.append(str(Y[i]))
print(' '.join(ans))

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

S = int(input())

M = 10 ** 9
t = (-S) % M
x = (S + t) // M

answer = [0,0,1,x,M,t]

print(*answer)

Solution (Python):
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    S = int(input())
    
    
    
    
    
    
    
    

    root_S = np.sqrt(S)
    l = int(np.ceil(root_S))
    X3Y2 = l ** 2 - S
    X1 = 0
    Y1 = 0
    X2 = l
    Y3 = l
    Y2 = l**2 - S
    X3 = 1
    print(X1, Y1, X2, Y2, X3, Y3)




if __name__ == '__main__':
    main()

Solution (Python):
s = int(input())
t = 10 ** 9
a = 0
b = 0
c = 0
d = 0
if s <= t:
    a = s
    d = 1
    c = 0
    b = 0
else:
    a = t
    k = s % a
    if k:
        d = s // a + 1
        c = a * d - s
        b = 1
    else:
        d = s // a
        c = 0
        b = 0
print(0, 0, a, b, c, d)

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

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

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


diff = sqrtS**2-S
divs = sorted(make_divisors(diff))
n = len(divs)

x0,y0 = (0,0)
if n == 0:
    x1,y1 = (0,sqrtS)
    x2,y2 = (sqrtS,0)
else:
    x1,y1 = (divs[n//2-1],sqrtS)
    x2,y2 = (sqrtS, diff//divs[n//2-1])

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

Solution (Python):
import numpy as np
import math

s=int(input())

if __name__=="__main__":
    if s==10**18:
        print(0,0,1000000000,0,0,1000000000)
    else:
        max_x=np.sqrt(s)
        keta=len(str(s))
        sita=(s//(10**(keta//2))+1)*(10**(keta//2))-s

        print(0, 0, s//(10**(keta//2))+1, sita, 1, 10**(keta//2))

Solution (Python):

sosu = [2]
now = 3

while now ** 2 <= 10 ** 9:

    for i in sosu:

        flag = True
        if now % i == 0:
            flag = False
            break

    if flag:
        sosu.append(now)

    now += 1



sosu.insert(0,1)



S = int(input())

lis = []


r = int(S ** 0.5)

st1 = r
st2 = r
mode = 0

while True:

    if st1 * st2 - S >= 0:

        cd = ( st1 * st2 ) - S

        for i in sosu:

            flag = False

            if cd % i == 0 and cd // i <= 10 ** 9 and st1 <= 10 ** 9 and st2 <= 10 ** 9:

                print (0,0,st1,cd // i,i,st2)
                flag = True
                break

    if flag:
        break

    if st2 == 10 ** 9 and st1 == 10 ** 9:
        mode = 1
        st1 = 10 ** 9
        st2 = r

    if mode == 1 and st1 * st2 < S:
        st1 -= 1
        st2 = r

    elif mode == 1:
        st2 -= 1

    elif st1 >= 10 ** 9:
        st2 += 1
        st1 = r

    else:
        st1 += 1

Solution (Python):
if __name__=='__main__':
    S = int(input())
    N = int(1e9)
    y2 = S//N + 1
    y3 = N - S%N
    if S >= 1e18:
        print("{} {} {} {} {} {}".format(0,0,0,N,N,0))
    else:
        print("{} {} {} {} {} {}".format(0,0,1,y2,N,y3))

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

def main():
    S = int(input())
    X1 = 0
    Y1 = 0
    X2 = int(math.sqrt(S))
    Y3 = S//X2
    if X2*Y3==S:
        X3=0
        Y2=0
    else:
        Y3+=1
        if Y3>10**9:
            X2=10**9
            Y3=10**9
        X3 = 1
        Y2 = (X2*Y3-S)
    print(X1,Y1,X2,Y2,X3,Y3)

if __name__ == '__main__':
    main()

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

import math

if s <= 1000000000:
	print(0)
	print(0)
	print(0)
	print(1)
	print(s)
	print(0)
elif math.ceil(math.sqrt(s)) == math.sqrt(s):
	print(0)
	print(0)
	print(0)
	print(int(math.sqrt(s)))
	print(int(math.sqrt(s)))
	print(0)
else:
	s_s = math.ceil(math.sqrt(s))
	d = s_s ** 2 - s
	print(0)
	print(0)
	print(s_s)
	print(1)
	if d <= s_s:
		print(d)
		print(s_s)
	else:
		print(d-s_s)
		print(s_s - 1)

Solution (Python):
s = int(input())
t = int(s**(1/2))
if s==1:
  print(0, 0, 1, 0, 0, 1)
elif t!=1 and s==t**2:
  t1 = t**2
  print(0, 0, t, 0, 0, t)
else:
  t1 = (t+1)**2
  t += 1
  t2 = abs(s-t1)
  ans = 0
  for i in range(int(t2**(1/2)), 0, -1):
    if t2%i==0:
      ans = i
      break
  print(0, 0, t, t2//ans, ans, t)

Solution (Python):

import sys

def solve(S: int):
    ans = []

    S2 = 10**9
    if S <= S2:
        ans = [0,0,1,0,0,S]
    else:
        A = min(int(S**0.5) + 1,10**9)

        B = A**2 - S
        ans = [0,0,A,B,1,A]

    print(" ".join([str(i) for i in ans]))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  
    solve(S)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    S = II()

    import math

    if S <= 10**9:
        print(S, 0, 0, 1, 0, 0)
    else:
        ceil = math.ceil(math.sqrt(S))
        m = (ceil-1) * ceil - S
        n = ceil * ceil - S
        if m >= 0:  
            print(ceil, m, 1, ceil-1, 0, 0)
        else:  
            print(ceil, n, 1, ceil, 0, 0)

main()

Solution (Python):
import math
from decimal import *

S = int(input())
s = Decimal(S).sqrt()
sd = math.ceil(s)
su = math.ceil(s)

diff = S - sd * su
x2 = -diff
y1 = 1

print(0, 0, sd, y1, x2, su)

Solution (Python):
import sys
import math
import copy

s=int(input());
a=math.sqrt(s);
d=copy.copy(a);
a1=copy.copy(a);
d1=copy.copy(a);
if s == 10**18:
    b=0;
    c=0;
else:
    a=int(a)+1;
    d=int(d)+1;
    b=a*d-s;
    while b > 10**9:
        a = a-1;
        d = d+1;
        b = a*d-s;
    if  d > 10**9:
        b = 10**10
        while b > 10**9:
            a1=int(a1)+1;
            d=int(d1);
            a = a1-1;
            b = a*d-s;

    c=1;

print(0, 0, int(a), int(b), int(c), int(d));

Solution (Python):
S = int(input())
x1 = int((S-1)/1000000000)+1
y2 = 1000000000
x2 = (1000000000 - S) % 1000000000
y1 = 1
if x1*y2-x2*y1 != S:
    x1 -= 1
print('{} {} {} {} {} {}'.format(0, 0, x1, y1, x2, y2))

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

x = [0] * 3
y = [0] * 3
bound = 10**9
import math

start = math.floor(math.sqrt(S))-1
x[1] = start
y[2] = start
tmp = x[1]*y[2]
while tmp < S:
    if x[1] < bound:
        x[1] += 1
    if y[2] < bound:
        y[2] += 1
    tmp = x[1]*y[2]

    
if tmp == S:
    x[2] = 0
    y[1] = 0
else:
    x[2] = 1
    y[1] = tmp-S

    
menseki = x[1]*y[2] - y[1]*x[2]

ans = []
for i in range(3):
    for j in range(2):
        if j == 0:
            ans.append(x[i])    
        else:
            ans.append(y[i])
            
print(' '.join(map(str,ans)))

Solution (Python):
import math
S=int(input())
s=math.ceil(S**0.5)
A=s
C2=A
C1=A-1
B=s**2-S
print(A,0,0,B,C1,C2,sep=' ')

Solution (Python):




import math
S=int(input())

X1=Y1=0
X2=Y3=math.ceil(math.sqrt(S))
Y2=1
X3=X2*Y3-S
print(X1,Y1,X2,Y2,X3,Y3)

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

mod=1000000000

x3=(S-1)//mod+1
y3=mod - ((S-1)%mod+1)

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

Solution (Python):
from math import ceil
from sys import stdin

def main():
    S = int(input())

    a = d = ceil(S ** 0.5)
    b = a * d - S
    c = 1
    print(0, 0, a, b, c, d)

input = lambda: stdin.readline()
main()

Solution (Python):
import sys, math
from collections import deque

readline = sys.stdin.readline

S = int(readline())

M = 10 ** 9
rS = math.ceil(math.sqrt(S))

while True:
    rem = rS ** 2 - S

    if rem == 0:
        print('0 0 {} {} {} {}'.format(rS, 0, 0, rS))
        exit(0)

    if rem <= M:
        b = rem
        break
    else:
        b = 0
        a = rem // M + 1
        c = math.floor(rem ** 0.5)
        while a < c and a < M:
            if rem % a == 0:
                b = a
                break
            a += 1
        if b != 0:
            break
    
    if rS >= M:
        rS = M - 1000
    else:
        rS += 1


print('0 0 {} {} {} {}'.format(rS, b, rem // b, rS))

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



root_S = S**(1/2)

if root_S == int(root_S):
  a, b, c, d = int(root_S), 0, 0, int(root_S)

else:
  a, d = int(root_S)+1, int(root_S)+1
  ad_S = a*d - S
  for b in range(1, 10**5):
    c = ad_S / b
    if c == int(c):
      c = int(c)
      break

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

Solution (Python):
M = 10**9

S = int(input())

if S == 10**18:
    print(0, 0, M, 0, M, M)
else:
    S1 = S//M + 1
    S2 = M - (S%M)

    print(0, 0, S1, 1, S2, M)

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

if int(math.sqrt(S))**2 == S:
    a = d = int(math.sqrt(S))
else:
    a = d = int(math.sqrt(S)) + 1

bc = a*d - S

if bc == 0:
    b = c = 0
else:
    for i in range(int(math.sqrt(bc)),0,-1):
        if bc % i == 0:
            b = i
            c = bc//i
            break

print(0,0,a,b,c,d)

Solution (Python):
import math

S = int(input())

p = math.ceil(math.sqrt(S))
p2 = p**2

x1 = y2 = p
x2 = p2 - S
y1 = 1

print(' '.join(map(str, [0,  0, x1, y1, x2, y2])))

Solution (Python):
s=int(input())
if s<=1000000000:
    print('0 0'+' '+str(s)+' 0 '+str(s)+' 1')
elif s!=10**18:
    k=s%1000000000
    S=1000000000-k
    T=s-k
    ans=['0','0',str(T//1000000000+1),'1',str(S),'1000000000']
    print(' '.join(ans))
else:
    ans=['0','0','1000000000','0','0','1000000000']
    print(' '.join(ans))

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

ans_list=[0 for _ in range(6)]
num=s
count=0

while(num>1000000000):
  num//=2
  count+=1
ans_list[0]=num
ans_list[3]=2**count

while(s>=ans_list[0]*ans_list[3] and ans_list[3]<1000000000):
  ans_list[3]+=1

if ans_list[3]>1000000000:
  ans_list[3]=1000000000
  ans_list[0]=s//1000000000+1
if ans_list[0]>1000000000:
  ans_list[0]=1000000000

ans_list[1]=1

sum_=ans_list[0]*ans_list[3]
ans_list[2]=sum_-s

print('{} {} {} {} {} {}'.format(ans_list[0],ans_list[1],ans_list[2],ans_list[3],ans_list[4],ans_list[5]))

Solution (Python):
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math

S = int(input())

a = math.ceil(S**0.5)

XY = []
XY.append(a)
XY.append(0)
rest = -S + a**2
if rest > a:
	XY.append(a - 1)
	XY.append(a - 1)
	rest = rest - a
else:
	XY.append(a - 1)
	XY.append(a)

XY.append(0)
XY.append(rest)

for i in range(6):
	print(XY[i], end="")
	print(" ", end="")
print("\n")

Solution (Python):
import math


class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

    def is_prime_brute_force(self, n):
        """
        brute force prime test
        use with is_prime_common if you want to skip seed_primes

        :param n:
        :return: boolean
        """
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True

    def is_prime_miller_rabin(self, n):
        """
        miller rabin prime test
        use with is_prime_common if you want to skip seed_primes

        see also
            algorithm: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
            implementation: https://qiita.com/srtk86/items/609737d50c9ef5f5dc59
            improvement: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """

        d = n - 1
        while d & 1 == 0:
            d >>= 1

        
        witnesses = self.get_witnesses(n)
        

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        """
        pseudo prime generator
        :param x:
        :param n:
        :param seed:
        :return: pseudo prime
        """
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        """
        find one of factor of n
        this function is based to Pollard's rho algorithm

        see also
            algorithm: https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
            implementation: https://qiita.com/gushwell/items/561afde2e00bf3380c98

        :param n:
        :param seed:
        :return: factor
        """
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes


prime = Prime()

s = int(input())

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

if n ** 2 == s:
    print("0 0 {n} 0 0 {n}".format(n=n))
    exit(0)

p = n ** 2 - s
dic = prime.find_factors(p)

muls = []
for k, c in list(sorted(dic.items())):
    for _ in range(c):
        muls.append(k)

a, b = 1, 1

for x in muls:
    if a < b:
        a *= x
    else:
        b *= x

print("0 0 {n} {y} {x} {n}".format(x=a, y=b, n=n))

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

a = int(s**0.5) + 1
b = int(s**0.5)
c = a**2 - s
d = s - b**2


ans_list = [0]*6

if d != 0:
    if c > d:
        ans_list = [0,1,b,0,d,b+1]
    else:
        ans_list = [0,0,a,1,c,a]
elif d == 0:
    ans_list = [0,0,b,0,0,b]

print(*ans_list)

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

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)
    exit()
x2, y3 = int(math.sqrt(S)) + 1, int(math.sqrt(S)) + 1
diff = x2*y3 - S
print(0, 0, x2, diff, 1, y3)

Solution (Python):
S = int(input())
a = S
S_10 = 0

while a>=1 :
    a = a/10
    S_10 += 1

if S_10%2 ==0:
    S_10_2 = S_10//2
else:
    S_10_2 = (S_10+1)//2



x1 = 10**S_10_2
y2 = S//x1 +1
x2 = 1
y1 = x1 - S%x1


if S_10==19:
    print('0 0 1000000000 0 0 1000000000')
else:
    print('0 0'+' '+str(x1)+' '+str(y1)+' '+str(x2)+' '+str(y2))

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import math

s = ni()

t = math.ceil(math.sqrt(s))
u = t
while True:
    if t * (u-1) < s:
        break
    u-=1

k = t*u-s

print(0,0,t,1,k,u)

Solution (Python):
import math
import sys
S=int(input())
x=[0]*3
y=[0]*3
if S==10**18:
    x[1]=10**9
    y[1]=0
    x[2]=0
    y[2]=10**9
    print(x[0],y[0],x[1],y[1],x[2],y[2])
    sys.exit()
x[1]=10**9
y[2]=S//(10**9)+1
y[1]=x[1]*y[2]-S
x[2]=1
print(x[0],y[0],x[1],y[1],x[2],y[2])

Solution (Python):
S = int(input())
if S <= 10**9:
	print(0,0,1,0,0,S)
	exit()

def search(n):
	l = 0
	r = 10**9
	while r - l > 1:
		p = (l+r)//2
		square = p*p
		if square == n:
			return p
		if square < n:
			l = p
		else:
			r = p
	return r

b = search(S)
tmp = b*b - S
if tmp % 2 == 0:
	print(0,0,b,2,tmp//2,b)
elif tmp <= 10**9:
	print(0,0,b,1,tmp,b)
else:
	print(0,0,b,1,tmp-b,b-1)

Solution (Python):
import numpy

from decimal import *
getcontext().prec = 20
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:
	T = int(numpy.sqrt(Decimal(S)))
	if S >= T*(T+1):
		R = T+1
	else:
		R = T
	U = (T+1)*R - S
	print(0,0,T+1,1,U,R)

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from math import sqrt, ceil

s = ni()

m = ceil(sqrt(s))
if m * m < s:
    m = m+1

if m*(m-1) >= s:
    x1, y1 = 0, 0
    x2, y2 = m, 1
    x3, y3 = m*(m-1) - s, m-1

else:
    x1, y1 = 0, 0
    x2, y2 = m, 1
    x3, y3 = m*m - s , m

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

Solution (Python):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    s = int(input())
    sub_val = 10 ** 18 - s

    x1 = 0
    y1 = 0
    x2 = 0
    y2 = 10 ** 9
    x3 = 10 ** 9
    y3 = 0

    sub_y2 = sub_val // 10 ** 9
    y2 = y2 - sub_y2
    sub_y3 = sub_val % 10 ** 9
    if sub_y3 != 0:
        y3 = 1
        x2 = sub_y3
    print(x1, y1, x2, y2, x3, y3)

Solution (Python):
from collections import defaultdict

max_x = 1000000000

if __name__ == '__main__':
    s = int(input())
    if s == max_x * max_x:
        print(0,0,max_x,0,0,max_x)
    else:
        y1, rem = divmod(s, max_x)
        y1 += 1
        rem = max_x - rem
        print(0,0,max_x,1,rem,y1)

Solution (Python):
s = int(input())
if s <= 10 ** 9:
    print('0 0 {} 0 0 1'.format(s))
else:
    y1 = s // 10 ** 9
    y2 = (s + 10 ** 9 - 1) // 10 ** 9
    x1 = s % 10 ** 9
    print('{} 0 0 {} {} {}'.format(x1, y1, 10**9, y2))

Solution (Python):
def solve(s):
    k = 10 ** 9
    if s <= k:
        return 0, 0, 1, 0, 0, s
    X = k
    while True:
        Y = (s - 1) // X + 1
        while Y <= k:
            xy = X * Y - s
            if xy == 0:
                return 0, 0, X, 0, 0, Y
            lim = min(Y, int(xy ** 0.5))
            for y in range(1, lim + 1):
                x, m = divmod(xy, y)
                if x <= X and m == 0:
                    return 0, 0, X, y, x, Y
            Y += 1
        X -= 1


s = int(input())
print(*solve(s))

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

Solution (Python):
import sys
input=sys.stdin.readline
s=int(input())
if s<=10**9:
    print(0,0,1,0,0,s)
else:
    INF=10**9
    x_2=(INF+s-1)//INF
    a=x_2*INF-s
    x_3=1
    y_2=a
    y_3=INF
    print(0,0,x_2,y_2,x_3,y_3)

Solution (Python):
import math

LIMIT = 10 ** 9

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

  if S == 10 ** 18:
    print('0 0 0 1000000000 1000000000 0')
    exit()

  if S <= LIMIT:
    print('0 0 1 0 0 ' + str(S))
    exit()
  else:
    a = S % LIMIT
    b = (S - a) // LIMIT + 1
    c = LIMIT - a
    print('0 0 1 1000000000 ' + str(b) + ' ' + str(c))

solve()

Solution (Python):

import sys
import os
import math


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

    X2 = 1
    X3 = 0
    Y3 = 0

    X1 = math.ceil(pow(S, 0.5))
    Y2 = X1
    Y1 = pow(X1, 2) - S

    print('%d %d %d %d %d %d' % (X1, Y1, X2, Y2, X3, Y3))


solve()

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

SS = int(S**0.5)

if SS*SS == S:
  X2 = 0
  Y1 = 0
  X1 = SS
  Y2 = SS
elif SS*(SS+1) == S:
  X2 = 0
  Y1 = 0
  X1 = SS
  Y2 = SS+1
elif SS*(SS+1) > S:
  X2 = SS*(SS+1)-S
  Y1 = 1
  X1 = SS
  Y2 = SS+1
elif (SS+1)*(SS+1) == S:
  X2 = 0
  Y1 = 0
  X1 = SS+1
  Y2 = SS+1
else:
  X2 = (SS+1)**2-S
  Y1 = 1
  X1 = SS+1
  Y2 = SS+1

X3 = 0
Y3 = 0

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

Solution (Python):
import math

S = int(input())

ss = int(math.sqrt(S)) + 1
if ss >= int(1E9):
    ss = int(1E9)

x1 = 1
y2 = abs(S-ss**2)
x2 = ss
y1 = ss

print(' '.join([str(a) for a in [0, 0, x1, y1, x2, y2]]))

Solution (Python):
S = int(input())
x0, y0 = 0, 0
n = pow(S, 1 / 2) + 1
n = int(n)
x1, y2 = n, n
x2 = n ** 2 - S
y1 = 1
num = 10 ** 9
if x1 <= num and y1 <= num and x2 <= num and y2 <= num:
    print(x0, y0, x1, x2, y1, y2)
else:
    x0, y0 = 0, 0
    n = 10 ** 9
    x1, y2 = n, n
    x2 = n ** 2 - S
    y1 = 1
    print(x0, y0, x1, x2, y1, y2)

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

rootS = S ** (1 / 2)


Xmax = int(rootS)

if Xmax < rootS:
    Xmax = Xmax + 1

Ymax = Xmax
delta = Xmax * Ymax-S


if delta != 0:
    root_delta = int(delta ** (1 / 2))
    for i in range(root_delta, 0, -1):
        
        if delta % i == 0:
            X = delta // i
            Y = i
            break
else:
    X = 0
    Y = 0




ans = "0 0 "+str(Xmax)+" "+str(Y)+" "+str(X)+" "+str(Ymax)
print(ans)

Solution (Python):
s = int(input())
A = 10 ** 9
if s <= A:
    x1, y2 = 1, s
    x2, y1 = 0, 0
elif s == 10 ** 18:
    x1, y2 = A, A
    x2, y1 = 0, 0
else:
    s1 = s % A
    s2 = s // A
    x1, y2 = s2 + 1, A
    x2, y1 = A - s1, 1
print(0, 0, x1, x2, y1, y2)

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

x0, y0 = 0, 0

ans = int(s**0.5) + 1
x1 = min(ans, 10**9)
y2 = min(ans, 10**9)


while True:
    tmp = x1*y2 - s
    cnt = 1
    while True:
        if tmp != 0 and tmp % 2 == 0:
            cnt *= 2
            tmp = tmp // 2
        else:
            a = cnt
            b = tmp
            if a <= 10**9 and b <= 10**9: 
                x2 = a
                y1 = b
                print(x0,y0,x1,y1,x2,y2)
                exit()
            else:
                x1 -= 1
                break

Solution (Python):
import math


def mintrial(t):
    tmp = int(math.sqrt(t)) + 1
    for num in range(2, tmp):
        while t % num == 0:
            return num
    return t


S = int(input())
s = math.sqrt(S)
ss = (int(s))**2
if ss == S:
    print(0, 0, int(s), 0, 0, int(s))
else:
    s = int(s)+1
    if s > 10**9:
        s = 10**9
    t = s ** 2 - S
    if t > 10**9:
        t2 = t
        while t2 > 10**9:
            t2 = mintrial(t2)
        t3 = t // t2
        print(0, 0, s, t2, t3, s)
    else:
        print(0, 0, s, 1, t, s)

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

if S == 10**18:
  x1 = 0
  x2 = 0
  x3 = 0
  x4 = 10 ** 9
  x5 = 10 ** 9
  x6 = 0
elif S >= 10**9: 
  num = (S // (10 ** 9) + 1) * 10 ** 9 - S
  x1 = 0
  x2 = 0
  x3 = num
  x4 = S // (10 ** 9) + 1
  x5 = 10 ** 9
  x6 = 1
else:
  x1 = 0
  x2 = 0
  x3 = 1
  x4 = S+1
  x5 = 1
  x6 = 1

print(x1, x2, x3, x4, x5, x6)

Solution (Python):
import math

S = int(input())
X1, Y1 = 0, 0

x = 1
N = math.ceil(S**0.5)
diff = N**2 - S

X2, Y3 = N, N

if N**2 == S:
    X3, Y2 = 0, 0
else:
    X3, Y2 = diff, 1

ans = [X1, Y1, X2, Y2, X3, Y3]
print(*ans)

Solution (Python):
s=int(input())
import math
sq=math.ceil(math.sqrt(s))

big=sq**2
sma=big-s

for i in range(math.floor(math.sqrt(big)),big+1):
    if big%i==0:
        big1=i
        big2=big//i
        break




if sma!= 0:
    
    for i in range(math.floor(math.sqrt(sma)),0,-1):
        if sma%i==0:
            sma1=i
            sma2=sma//i
            break
else:
    sma1=0
    sma2=0


x1=big1
y1=sma1
x2=sma2
y2=big2
x3=0
y3=0

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7


debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    S = II()

    import math
    s = math.sqrt(S)
    if int(s) == s:
        print(0, 0, 0, int(s), int(s), 0)
        return

    sd = math.floor(s)
    su = math.ceil(s)
    x1 = su
    y1 = 0
    x2 = 1
    y2 = su
    Stmp = x1 * y2
    diff = Stmp - S
    y1 = diff

    dprint(S, s, sd, su)

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

solve()

Solution (Python):

LIMIT = 10**9

def solve():
    S = int(raw_input())
    c = S / LIMIT
    b = S % LIMIT
    x1minusx3 = LIMIT
    x2minusx3 = b
    y2minusy3 = c
    y1minusy3 = -1
    x3 = 0
    y3 = 1
    x1 = x1minusx3 + x3
    x2 = x2minusx3 + x3
    y1 = y1minusy3 + y3
    y2 = y2minusy3 + y3
    if S == 10**18:
        y3 = 0
        y1 = 0
        y2 = y2minusy3
    
    print x1, y1, x2, y2, x3, y3

if __name__ == '__main__':
    solve()

Solution (Python):
import math
import sys
s=int(input())
if s==10**18:
  print('0 0 0 1000000000 1000000000 1000000000')
  sys.exit()
x=math.floor(math.sqrt(s))+1
y=x*(x-1)-s
y2=x*x-s
if y>0:
  l=['0','0','1',str(x-1),str(x),str(y)]
else:
  l=['0','0','1',str(x),str(x),str(y2)]
print(' '.join(l))

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




def triArea(y2, y3):
  return abs(y3-y2*M)

f = 0
t = M+1
while f + 1 < t:
  y2 = f + (t - f) // 2
  maxArea = triArea(y2, 0)
  minArea = triArea(y2, M)
  if S < minArea:
    t = y2
  elif S > maxArea:
    f = y2
  else:
    f = y2
    break
y2 = f

f = 0
t = M+1
while f + 1 < t:
  y3 = f + (t - f) // 2
  area = triArea(y2, y3)
  if S <= area:
    f = y3
  else:
    t = y3
y3 = f
print(0, 0, 1, y2, M, y3)

Solution (Python):
S = int(input())
s = int(S**.5)
if s*s != S:
    s += 1
    if s > 10**9:
        s = 10**9


x1 = 0
y1 = 0
x2 = 0
y2 = 0
x3 = 0
y3 = 0


x2 = s
y3 = s
x3 = 1
y2 = x2*y3 - S

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