Harryxun/stf_run huggingface dataset:
from collections import deque

N = int(input())
A = deque(sorted(list(map(int,input().split()))))

operation = []
for i in range(N-1):
    if i%2==0: # Negative
        x = A.pop()
        y = A.popleft()
        operation.append(f'{x} {y}')
        A.appendleft(y + x * -1)
    else: # Positive
        x = A.popleft()
        y = A.pop() 
        operation.append(f'{x} {y}')
        A.append(y + x * -1)

print(sum(list(A)))
for o in operation:
    print(o)

### FIXED CODE ###

import sys
N = int(input())
A = sorted(list(map(int,input().split())))

mn = A[0]
mx = A[-1]
if N ==2:
    print(A[1] - A[0])
    print(A[1],A[0])
    sys.exit()
ope = []
for a in A[1:-1]:
    if a <=0:
        ope.append([mx, a])
        mx -= a
    else:
        ope.append([mn, a])
        mn -= a
ope.append([mx,mn])
print(mx-mn)
for o in ope:
    print(o[0],o[1])
from collections import deque
import sys

INF = 10 ** 8

H, W = map(int,input().split())
CH, CW = map(int,input().split())
DH, DW = map(int,input().split())

S = []
for _ in range(H):
    S.append(list(input()))

d = [[INF for i in range(W)] for j in range(H)]

Q = deque([CH-1, CW-1, 0])
d[CH-1][CW-1] = 0

while len(Q) != 0:
    x, y, cnt = Q.popleft()
    
    if x == DH-1 and y == DW-1:
        print(cnt)
        sys.exit()
    
    for tx in range(-2, 3):
        for ty in range(-2, 3):
            nx = x + tx
            ny = y + ty
            if 0 <= nx < H and 0 <= ny < W and MAP[nx][ny] == "." and d[nx][ny] == INF:
                if abs(tx)+abs(ty) == 1:
                    d[nx][ny] = cnt
                    Q.appendleft([nx, ny, cnt])
                else:
                    d[nx][ny] = cnt + 1
                    Q.append([nx, ny, cnt + 1])

print(-1)

### FIXED CODE ###

from collections import deque
import sys

INF = 10 ** 8

H, W = map(int,input().split())
C = list(map(int,input().split()))
D = list(map(int,input().split()))
MAP = []
for _ in range(H):
    MAP.append(list(input()))
d = [[INF for i in range(W)] for j in range(H)]
tx = [1, 0, -1, 0]
ty = [0, 1, 0, -1]
tx_y = [(i, j) for i in range(-2, 3) for j in range(-2, 3)]

Q = deque()
Q.append([C[0]-1, C[1]-1, 0])

while len(Q) != 0:
    x, y, cnt = Q.popleft()
    
    if x == D[0]-1 and y == D[1]-1:
        print(cnt)
        sys.exit()
    
    for i in range(4):
        nx = x + tx[i]
        ny = y + ty[i]
        if 0 <= nx < H and 0 <= ny < W and MAP[nx][ny] == "." and d[nx][ny] > cnt:
            d[nx][ny] = cnt
            Q.appendleft([nx, ny, cnt])
    
    for i, j in tx_y:
        nx = x + i
        ny = y + j
        if 0 <= nx < H and 0 <= ny < W and MAP[nx][ny] == "." and d[nx][ny] > cnt+1:
            d[nx][ny] = cnt+1
            Q.append([nx, ny, cnt+1])

print(-1)
s = int(input())
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")


### FIXED CODE ###

s = input()
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")
n, q = [int(i) for i in input().split()]
a1 = {}
a2 = {}
for _ in range(n - 1):
    x, y = [int(i) - 1 for i in input().split()]
    if x in a1:
        a1[x].append(y)
    else:
        a1[x] = [y]
    if y in a2:
        a2[y].append(x)
    else:
        a2[y] = [x]
root = [-1] * n

def c(ind=0, ro=-1):
    global root
    if root[ind] != -1:
        return 0
    root[ind] = ro
    if ind in a1:
        for i in a1[ind]:
            if i!=0:
                c(i, ind)
    if ind in a2:
        for i in a2[ind]:
            if i!=0:
                c(i, ind)


c()
p = [0] * n
for _ in range(q):
    x, y = [int(i) for i in input().split()]
    p[x - 1] += y
r = []
for i in range(n):
    j = i
    k = 0
    while True:
        k += p[j]
        if j == -1:
            break
        j = root[j]
    r.append(str(k))
print(" ".join(r))


### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)


def input():
    return sys.stdin.readline()


n, q = [int(i) for i in input().split()]
ab = [[] for _ in range(n)]
for _ in range(n - 1):
    i, j = [int(i)-1 for i in input().split()]
    ab[i].append(j)
    ab[j].append(i)
p = [0]*n
for _ in range(q):
    i, j = [int(i) for i in input().split()]
    p[i-1] += j

al = [False]*n
pp = [0]*n


def a(i=0, j=0):
    al[i] = True
    j += p[i]
    pp[i] = str(j)
    for k in ab[i]:
        if not al[k]:
            a(k, j)


a()
print(" ".join(pp))
N = int(input())
A = [0] + list(map(int, input().split()))
diff = []
for i in range(N):
  diff.append(abs(A[i]-A[i+1]))

diff.append(abs(A[-1]))a

A += [0]
s = sum(diff)
for i in range(N):
  v = s - diff[i] - diff[i+1]
  v += abs(A[i] - A[i+2])
  print(v)

### FIXED CODE ###

N = int(input())
A = [0] + list(map(int, input().split()))
diff = []
for i in range(N):
  diff.append(abs(A[i]-A[i+1]))

diff.append(abs(A[-1]))

A += [0]
s = sum(diff)
for i in range(N):
  v = s - diff[i] - diff[i+1]
  v += abs(A[i] - A[i+2])
  print(v)
alpha = 'abcdefghijklmnopqrstuvwxyz'
N= int(input())
len_alpha = 26
tmp = N
calc = tmp
cnt = 1

while tmp > 0:
    calc = tmp
    tmp -= (len_alpha **cnt)
    cnt += 1

res =''
for i in range(1, cnt - 1):
    tmp = int(calc/(len_alpha**(cnt - i - 1)))
    calc -= tmp * len_alpha**(cnt - i - 1)
    res += alpha[tmp]

res += alpha[calc-1]
print(res)

### FIXED CODE ###

alpha = 'abcdefghijklmnopqrstuvwxyz'
N= int(input())
len_alpha = 26
tmp = N
calc = tmp
cnt = 1

while tmp > 0:
    calc = tmp
    tmp -= (len_alpha **cnt)
    cnt += 1

res =''
for i in range(1, cnt - 1):
    tmp = int((calc-1)/(len_alpha**(cnt - i - 1)))
    calc -= tmp * len_alpha**(cnt - i - 1)
    res += alpha[tmp]

res += alpha[calc-1]
print(res)
S=int(input())
import math

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

possibles=1
biggest_sub=S//3
for i in range(2,biggest_sub+1):
	left=S-3*i
	possibles+=nCr(left+i-1,i-1)
n=10**9+7
print(possibles%n)

### FIXED CODE ###

#import sys
#input = sys.stdin.readline
Q = 10**9+7
def cmb(n,r):
    if n-r < r: r = n-r
    if r == 0: return 1
    denominator = 1                       #分母
    numerator = 1                         #分子
    for i in range(r):
        numerator *= n-i
        numerator %= Q
        denominator *= i+1
        denominator %= Q
    return numerator*pow(denominator, Q-2, Q)%Q
 
def main():
    S = int( input())
    ans = 0
    for i in range(1, S//3+1):
        t = S - i*3
        ans += cmb(t+i-1,i-1)
        ans %= Q
    print(ans)
        
if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
import sys

N,Q=map(int, sys.stdin.readline().split())
s=raw_input()
q=[ sys.stdin.readline().split()  for i in range(Q) ]


def leftout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur<0:
			return True
			break
		elif cur>N-1:
			return False
			break			

	else:
		return False


def rightout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur>N-1:
			return True
			break
		if cur<0:
			return False
			break
	else:
		return False



#左側から落ちるゴーレム
l=0
r=N
while l!=r:
	m=(l+r)/2+1
	if leftout(m):
		l=m
	else:
		r=m-1
sl=l


#右側から落ちるゴーレム
l=0
r=N
while l!=r:
	m=(l+r)/2
	if rightout(m):
		r=m
	else:
		l=m+1
sr=r

print sr-sl-1



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N,Q=map(int, sys.stdin.readline().split())
s=raw_input()
q=[ sys.stdin.readline().split()  for i in range(Q) ]

def leftout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur<0:
			return True
			break
		elif cur>N-1:
			return False
			break			

	else:
		return False


def rightout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur>N-1:
			return True
			break
		if cur<0:
			return False
			break
	else:
		return False


l=-1
r=N
while r-l!=1:
	m=(l+r)/2
	if leftout(m):
		l=m
	else:
		r=m
sl=l

l=-1
r=N
while r-l!=1:
	m=(l+r)/2
	if rightout(m):
		r=m
	else:
		l=m

sr=r


ans=N
if sl>=0:
	ans-=(sl+1)
if sr<N:
	ans-=(N-sr)

print ans
#coding:utf-8
a, b = map(int, input())

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)

### FIXED CODE ###

#coding:utf-8
a, b = map(int, input().split())

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)
N, K = map(int, input().split())
A = list(map(int, input().split()))

mod = 10**9 + 7

Am, Ap = [], []
pm = [0, 0, 0]
Flag = True

for x in A:
  if x < 0:
    Am.append(-x)
    pm[0] += 1
  elif x == 0:
    pm[1] += 1
  else:
    Ap.append(x)
    pm[2] += 1

Am.sort()
Ap.sort()
ans = 1

if N-K < pm[1]:
  print(0)
  exit()

if pm[0] == N:
  for i in range(K):
    ans *= Am[i]
    ans %= mod
  ans *= (-1)
  print(ans%mod)
  exit()

Bm = sorted(zip(Am, [1]*pm[0]))
Bp = sorted(zip(Ap, [0]*pm[2]))

B = Bm + Bp
B.sort(reverse = True)
cnt = 0

for i in range(K):
  if i == K-1:
    cnt %= 2
    if cnt != B[i][1]:
      break
    else:
      ans *= B[i][0]
      ans %= mod
      print(ans)
      exit()
  else:
    ans *= B[i][0]
    ans %= mod
    cnt += B[i][1]

ans1 = ans
ans2 = ans * B[K][0] % mod

mcnt1 = 0
for i in range(K, N-pm[1]):
  if B[i][1] == cnt:
    mcnt1 += 1
    ans1 *= B[i][0]
    ans1 %= mod
    break

#mcnt2 = 0
for i in range(K-1, -1, -1):
  if B[i][1] == cnt:
    #mcnt2 += 1
    r = pow(B[i][0], mod-2, mod)
    ans1 *= r
    ans1 %= mod
    break

if mcnt1 == 1:
  print(max(ans1, ans2))
else:
  print(ans2)

### FIXED CODE ###

import copy

N, K = map(int, input().split())
A = list(map(int, input().split()))

mod = 10**9 + 7

Am, Ap = [], []
pm = [0, 0]
B = []

def ans(A):
  ans = 1
  for x in A:
    ans *= x
    ans %= mod
  return ans

if N == K:
  print(ans(A))
  exit()

for x in A:
  if x < 0:
    Am.append(-x)
    B.append((-x, 1))
    pm[0] += 1
  else:
    Ap.append(x)
    B.append((x, 0))
    pm[1] += 1

Am.sort()

if pm[0] == N:
  if K%2 == 0:
    print(ans(Am[N-K:]))
  else:
    print((-1 * ans(Am[:K]))%mod)
  exit()

P = []
B.sort(reverse = True)

cnt = 0

p_min = (-1, -1)
m_min = (-1, -1)

for i in range(K):
  P.append(B[i][0])
  cnt ^= B[i][1]
  if B[i][1] == 0:
    p_min = (B[i][0], i)
  else:
    m_min = (B[i][0], i)

if cnt == 0:
  print(ans(P))
  exit()

P1 = copy.deepcopy(P)
P2 = copy.deepcopy(P)

p_max = (-1, -1)
m_max = (-1, -1)

for i in range(K, N):
  if B[i][1] == 0:
    p_max = (B[i][0], i)
    break

for i in range(K, N):
  if B[i][1] == 1:
    m_max = (B[i][0], i)
    break

Flag1 = False
Flag2 = False

if p_min[1] != -1 and m_max[1] != -1:
  Flag1 = True
  P1[p_min[1]] = 1
  P1.append(m_max[0])
  ans1 = ans(P1)

if m_min[1] != -1 and p_max[1] != -1:
  Flag2 = True
  P2[m_min[1]] = 1
  P2.append(p_max[0])
  ans2 = ans(P2)

if Flag1 and Flag2:
  if m_min[0]*m_max[0] > p_min[0]*p_max[0]:
    print(ans1)
  else:
    print(ans2)
elif Flag1:
  print(ans1)
else:
  print(ans2)
#N=3485
#A=[ 32, 1, 87, 25, 36]
N=int(input())


for i in range(1,3501):
    for j in range(1,3501):
        u=-N*i*j
        d=N*i+N*j-4*i*j
        if(u%d==0 and (u*d > 0)):
            k=u//d
            if(N*(i*j+j*k+k*i)==4*i*j*k):
                print(i,j,k)
                exit()

### FIXED CODE ###

#N=3485
#A=[ 32, 1, 87, 25, 36]
N=int(input())


for i in range(1,3501):
    for j in range(1,3501):
        u=-N*i*j
        d=N*i+N*j-4*i*j
        if(d!=0):
            if(u%d==0 and (u*d > 0)):
                k=u//d
                if(N*(i*j+j*k+k*i)==4*i*j*k):
                    print(i,j,k)
                    exit()
n, m = map(int,input().split())

ans = [0 for i in range(n)]

for i in range(m):
    r,s = map(int,input().split())
    if r-1 == 0 and s = 0:
        ans = [-1]
        break
    if ans[r-1] != 0 and ans[r-1] != s:
        ans = [-1]
        break
    ans[r-1] = s
if ans[0] == 0:
    ans[0] = 1
sum = ""
for i in range(len(ans)):
    sum += str(ans[i])
print(sum)

### FIXED CODE ###

n, m = map(int,input().split())

ans = [0 for i in range(n)]

for i in range(m):
    r,s = map(int,input().split())
    if n != 1 and r-1 == 0 and s == 0:
        ans = [-1]
        break
    if ans[r-1] != 0 and ans[r-1] != s:
        ans = [-1]
        break
    ans[r-1] = s
if n != 1 and ans[0] == 0:
    ans[0] = 1
sum = ""
for i in range(len(ans)):
    sum += str(ans[i])
print(sum)
a=""
s,t=input(),input()
for i in range(len(s)):a+=s[i]+t[i]
print(a)

### FIXED CODE ###

a,b,s=input(),input(),""
for i in range(len(a)-1):s+=a[i]+b[i]
if len(a)!=len(b):s+=a[-1]
else:s+=a[-1]+b[-1]
print(s)
#prdさんから参照
N = int(input())
#これが唯一の事実データ
src = [tuple(map(int,input().split())) for i in range(N)]
 
INF = float('inf')
#ここ以降でかかれてあるcx,cyはあくまで頂上であると仮定しているだけで条件と合わない場合に不適切な座標となる。
for cx in range(0,101):
    for cy in range(0,101):
        tmph = None
        maxh = INF
        for x,y,h in src:
            if h > 0:
                tmp = h + abs(x-cx) + abs(y-cy)
                if tmph is None:
                    tmph = tmp
                else:
                    if tmp != tmph:
                        break
#                 if tmph > maxh:
#                     break
            else:
                #ここでmaxhがtmphよりも小さくなってしまった場合、hは0だから頂点からのxとyの差の和がtmphはなければならないのに、それを下回っているため
                #データx,yは絶対的な値なのでcx,cyが間違っていることになる。それを判定するのが上のtmph > maxh の時となり
                maxh = min(maxh, abs(x-cx) + abs(y-cy))
                #最低でも1つはピラミッド内の座標がないと解けないのでここはいらない？
#                 if maxh == 1:
#                     tmph = 1
                if tmph > maxh:
                    break
        else:
            
#             for x,y,h in src:
#                 if max(tmph - abs(x-cx) - abs(y-cy), 0) != h:
#                     break
#             else:
            print(cx,cy,tmph)
            exit()

### FIXED CODE ###

#模範解答
N = int(input())
#これが唯一の事実データ
src = [tuple(map(int,input().split())) for i in range(N)]
 
INF = float('inf')
#ここ以降でかかれてあるcx,cyはあくまで頂上であると仮定しているだけで条件と合わない場合に不適切な座標となる。
for cx in range(0,101):
    for cy in range(0,101):
        tmph = None
        maxh = INF
        for x,y,h in src:
            if h > 0:
                tmp = h + abs(x-cx) + abs(y-cy)
                if tmph is None:
                    tmph = tmp
                else:
                    if tmp != tmph:
                        break
                if tmph > maxh:
                    break
            else:
                #ここでmaxhがtmphよりも小さくなってしまった場合、hは0だから頂点からのxとyの差の和がtmphはなければならないのに、それを下回っているため
                #データx,yは絶対的な値なのでcx,cyが間違っていることになる。それを判定するのが上のtmph > maxh の時となり
                maxh = min(maxh, abs(x-cx) + abs(y-cy))
                #ピラミッドが高さ１の頂点のみだった場合、h=1のデータが与えられていればいいがh=０しか与えられていない時のため
#                 if maxh == 1:
#                     tmph = 1
        else:
            for x,y,h in src:
                if max(tmph - abs(x-cx) - abs(y-cy), 0) != h:
                    break
            else:
                print(cx,cy,tmph)
                exit()
x =input(input())
print(x**3)

### FIXED CODE ###

x = int(input())
print( x ** 3)
#!/usr/bin/python3
# -*- coding: utf-8 -*-

N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
count = 1
for i in range(N+1):
    D += L[i]
    if D > X:
        print(count)
        exit()
    else:
        count += 1

### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-

N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
count = 1
for i in range(N):
    D += L[i]
    if D > X:
        print(count)
        exit()
    else:
        count += 1
print(count)
x , n = map(int , input().split())
b = list(map(int,input().split()))
for i in b:
    a[i] = 1
t = 1
ans = 0
while 1:
    if x-t not in b:
        ans = x - t
        break
    if x+t not in b:
        ans = x + t
        break
    t += 1
print(ans)

### FIXED CODE ###

x , n = map(int , input().split())
b = []
if n!=0:
    b = list(map(int,input().split()))
t = 0
ans = 0
while 1:
    if x-t not in b:
        ans = x - t
        break
    if x+t not in b:
        ans = x + t
        break
    t += 1
print(ans)
import math

l = [int(x) for x in input().split]

print(math.ceil(l[0]*l[1]))

### FIXED CODE ###

import math
 
l = [int(x) for x in input().split()]

if l[0] == 1 or l[1] == 1:
  print(1)
else:
  print(math.ceil((l[0]*l[1])/2))
import math


def solve():
    a, b, c, d = map(int, input().split())
    lcm = c * d // math.gcd(c, d)
    div_c = b // c - (a - 1) // c
    div_d = b // d - (a - 1) // d
    div_cd = b // lcm - (a - 1) // lcm
    return (b - a + 1) - div_c - div_d + div_cd


if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

import fractions


def solve():
    a, b, c, d = map(int, input().split())
    lcm = c * d // fractions.gcd(c, d)
    div_c = b // c - (a - 1) // c
    div_d = b // d - (a - 1) // d
    div_cd = b // lcm - (a - 1) // lcm
    return (b - a + 1) - div_c - div_d + div_cd


if __name__ == "__main__":
    print(solve())
s = input()

    a = False
    for i in range(len(s)):
        if s[i] == "A":
            a = True
            break

    b = False
    for i in range(len(s)):
        if s[i] == "B":
            b = True
            break

    print(a and b)

### FIXED CODE ###

s = input()

a = False
for i in range(len(s)):
    if s[i] == "A":
        a = True
        break

b = False
for i in range(len(s)):
    if s[i] == "B":
        b = True
        break

if a and b:
    print("Yes")
else:
    print("No")
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)
def G(x,y):
    if(x<y):
        x,y=y,x
    if(y==0):
        return x
    return G(y,x%y)


a,b,c,d=l()
ans=0
# print(a,b,c,d,b//c,a//c)
ans+=(b//c-a//c+(a%c==0))
# print(ans)
ans+=(b//d-a//d+(a%d==0))
# print(ans)
lcm=c*d//G(c,d)
ans-=(b//lcm-a//lcm+(a%lcm==0))
print(b-a+1-ans)

### FIXED CODE ###

def G(x,y):
    if(x<y):
        x,y=y,x
    if(y==0):
        return x
    return G(y,x%y)


a,b,c,d=map(int,input().split())
ans=0
# print(a,b,c,d,b//c,a//c)
ans+=(b//c-a//c+(a%c==0))
# print(ans)
ans+=(b//d-a//d+(a%d==0))
# print(ans)
lcm=c*d//G(c,d)
ans-=(b//lcm-a//lcm+(a%lcm==0))
print(b-a+1-ans)
N, M = int(input())
if N == M:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N, M = map(int,input().split())
if N == M:
  print("Yes")
else:
  print("No")
%%time
def combinations(R, G, B, N):
    R, G, B, N = int(R), int(G), int(B), int(N)
    sorted_tuple = sorted((R, G, B), reverse=True)
    R = sorted_tuple[0]
    G = sorted_tuple[1]
    B = sorted_tuple[2]
    number_combos = 0
    print(R)
    print(G)
    print(B)
    for x in range(N + 1):
        N_modified_x = N - R * x
        for y in range(N_modified_x + 1):
            N_modified_y = (N_modified_x - G * y) // B
            for z in range(N_modified_y + 1):
                if z == N_modified_y:
                    number_combos += 1
    return number_combos

R, G, B, N = input().split(' ')
print(combinations(R, G, B, N))

### FIXED CODE ###

def combinations(R, G, B, N):
    R, G, B, N = int(R), int(G), int(B), int(N)
    sorted_tuple = sorted((R, G, B), reverse=True)
    R = sorted_tuple[0]
    G = sorted_tuple[1]
    B = sorted_tuple[2]
    number_combos = 0

    for x in range(N // R + 1):
        for y in range((N - R * x) // G + 1):
            if (N - R * x - G * y) % B == 0:
                number_combos += 1
        
    return number_combos

R, G, B, N = input().split(' ')
print(combinations(R, G, B, N))
A, B, C, D, E, F = map(int, input().split())


ws = set()
ss = set()
for a in range(0, F+1, A*100):
    for b in range(0, F-a+1, B*100):
        ws.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F-c+1, D):
        ss.add(c + d)

mx = 0
ans = None
for w in ws:
    if w == 0:
        continue
    for s in ss:
        x = s * 100 / w
        if w + s <= F and x <= E and mx < x:
            mx = x
            ans = [s + w, s]

print(' '.join(map(str, ans)))


### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())
W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        W.add(a+b)
S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s * 100 <= E * w:
            if s / (s + w) > rate:
                rate = s / (s + w)
                ans = w + s, s
print(ans[0], ans[1])
n,m = map(int, input().split())

from collections import defaultdict 
V = defaultdict(list)

for _ in range(m):
    a,b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

def dfs(source):
    dist = [-1]*(n+1)
    dist[source] = 0
    q = [source]
    while q and cur <3:
        a = q.pop()
        for b in V[a]:
            if dist[b]!=-1:
                continue
            dist[b] = dist[a] + 1
            q.append(b)
        cur = dist[b]
    return dist

d1 = dfs(1)
if d1[n] ==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

n,m = map(int, input().split())

from collections import defaultdict 
V = defaultdict(list)

for _ in range(m):
    a,b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

from collections import deque

def bfs(u):
    queue = deque([u])
    d = [None] * (n+1) # uからの距離の初期化
    d[u] = 0 # 自分との距離は0
    while queue:
        v = queue.popleft()
        for i in V[v]:
            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
    return d

b1 = bfs(1)
if b1[n] ==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  5 09:53:48 2019

@author: Enya
"""

input_code = input()

A = input_code[0]*3 + input_code[1]
N = 0

if A>3:
    N = A//3

else:
    N = 0
    
print(N)
    

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Jun  5 09:53:48 2019

@author: Enya
"""

input_code = input()
A = int(input_code.split()[0])
P = int(input_code.split()[1])

X = A*3 + P

print(X//2)
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N,C = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]

time = [0]*(2*(10**5))
for l in L:
    time[l[0]*2-1] += 1
    time[l[1]*2] -= 1

ans = 0
tmp = 0
for t in time:
    tmp += t
    ans = max(ans, tmp)

print(ans)

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N,C = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]

T_MAX = 10**5
time = [[0]*C for i in range(T_MAX)]

for s,t,c in L:
    time[s-1][c-1] += 1
    time[t-1][c-1] -= 1
 
ans = 0
tmp = 0
for i in range(T_MAX):
    tmp += time[i].count(1)
    ans = max(ans,tmp)
    tmp -= time[i].count(-1)

print(ans)
fist = list(map(int, input().split()))
N = fist[0]
X = fist[1]
DList=[]
kosu=0
for i in range(N):
    DList.append(int(input()))
X -= sum(DList)
kosu += len(DList)

sD = min(Dlist)

while X >sD:
    X -= sD
    kosu += 1
    print(kosu)

### FIXED CODE ###


fist = list(map(int, input().split()))
N = fist[0]
X = fist[1]
DList=[]
kosu=0
for i in range(N):
    DList.append(int(input()))
X -= sum(DList)
kosu += len(DList)

sD = min(DList)

while X >= sD:
    X -= sD
    kosu += 1
print(kosu)
H,W=map(int, input().split())
c=[input().split() for i in range(W)]
a=[0]*W
ans=''
   
for i in range(2*H):
    ans=''
    for j in range(W):
        #print((i)//2)
        a[j]=c[int((i)//2)][j]
        ans+=a[j]
    print(ans)

### FIXED CODE ###

h, w = map(int, input().split())  
for i in range(h):
    s = input()
    print(s)
    print(s)