Harryxun/stf_run huggingface dataset:
N = int(input())
A = [int(_) for _ in input().split()]

mxs = sorted(x for x in A if x < 0)
pxs = sorted(x for x in A if x >= 0)

if len(mxs) == 0:
    mxs = [pxs[0]]
    pxs = pxs[1:]

#print(mxs, pxs)

result = sum(pxs) - sum(mxs)
print(result)

if len(pxs) == 1:
    for y in mxs:
        print(pxs[0], y)
        pxs[0] -= y
else:
    for y in pxs[:-1]:
        print(mxs[0], y)
        mxs[0] -= y
    print(pxs[-1], mxs[0])
    pxs[-1] -= mxs[0]
    for y in mxs[1:]:
        print(pxs[-1], y)
        pxs[-1] -= y

#for i in range





### FIXED CODE ###

N = int(input())
A = [int(_) for _ in input().split()]

mxs = sorted(x for x in A if x < 0)
pxs = sorted(x for x in A if x >= 0)

if len(mxs) == 0:
    mxs = [pxs[0]]
    pxs = pxs[1:]

if len(pxs) == 0:
    pxs = [mxs[-1]]
    mxs = mxs[:-1]

#print(mxs, pxs)

result = sum(pxs) - sum(mxs)
print(result)

if len(pxs) == 1:
    for y in mxs:
        print(pxs[0], y)
        pxs[0] -= y
else:
    for y in pxs[:-1]:
        print(mxs[0], y)
        mxs[0] -= y
    print(pxs[-1], mxs[0])
    pxs[-1] -= mxs[0]
    for y in mxs[1:]:
        print(pxs[-1], y)
        pxs[-1] -= y

#for i in range
import math
A, B = map(int, input().split())

print(A*B//math.gcd(A, B))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())

print(A*B//fractions.gcd(A, B))
X,N = map(int,input().split())
P = list(map(int,input().split()))
m = {}
for i in range(1, 101):
    if i in P:
        continue
    ab = abs(i - X)
    m[i] = ab
min_k_list = [kv[0] for kv in m.items() if kv[1] == min(m.values())]
print(min(min_k_list))


### FIXED CODE ###

X,N = map(int,input().split())
P = list(map(int,input().split()))
m = {}
for i in range(102):
    if i in P:
        continue
    ab = abs(i - X)
    m[i] = ab
# min_kv_list = [kv for kv in m.items() if kv[1] == min(m.values())]
min_k_list = [kv[0] for kv in m.items() if kv[1] == min(m.values())]
print(min(min_k_list))
n = int(input())
lr = [map(int,input().split()) for l in range(n)]
ans = 0
for i in lr:
  ans += lr[i][1] - lr[i][0]+1
print(ans)

### FIXED CODE ###

n = int(input())
lr = [list(map(int,input().split())) for l in range(n)]
ans = 0
for i in range(len(lr)):
  ans += (lr[i][1] - lr[i][0])+1
print(ans)
import math
def f(b,n):
    if n<b:
        return n
    return f(b,n//b)+n%b

def main():
    n=int(input())
    s=int(input())
    if n==s:
        return n+1
    elif n <s:
        return -1
    else:
        for b in range(2,int(math.sqrt(n))+2):
            if f(b,n)==s:
                print(b)
                exit()
        for p in range(int(math.sqrt(n-s)+1),0,-1):
            b=(n-s)//p+1
            if f(b,n)==s:
                return b
    return -1

if __name__ == '__main__':
    print(main())


### FIXED CODE ###

n = int(input())
s = int(input())

def f(b,n):
  if n < b:
    return n
  return f(b,n//b) + n%b


def solve(n,s):
  if s > n:
    return -1
  if s == n:
    return n+1
  nsq = int(n**0.5 + 1)
  for b in range(2,nsq+1):
    if f(b,n) == s:
      return b
  # 2桁で作れるかどうか
  # n = bx+y, s = x+y, x,y < b
  # n - s = (b-1)x, x < b
  m = n-s
  msq = int(m**0.5+1)
  for x in range(msq,0,-1):
    if m%x:
      continue
    b = m//x+1
    if f(b,n) == s:
      return b
  return -1
  
answer = solve(n,s)
print(answer)
A, B = int(input().split())
if A - 2 * B <= 0:
  print(0)
else:
  print(A-2*B)

### FIXED CODE ###

A, B = map(int, input().split())
if A - 2 * B <=0:
  print(0)
else:
  print(A - 2 * B)
print(input() if len(input())==2 else input()[::-1])

### FIXED CODE ###

a=input()
print(a if len(a)==2 else a[::-1])
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
if c.most_common()[0][1] => 2:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
if c.most_common()[0][1] >= 2:
    print("NO")
else:
    print("YES")
N,L = map(int,input().split())
s = sorted([int(innput()) for i in range(N)])
print(*s,sep="")

### FIXED CODE ###

n,l = map(int,input().split())
s = sorted([input() for i in range(n)])
print(*s,sep='')
H,W = map(int,input().split())

s = []

for i in range(H):

    S = list(input())
    s.append(S)

dis = [[float("inf")] * W for i in range(H)]

if s[0][0] == "#":
    dis[0][0] = 1
else:
    dis[0][0] = 0

for i in range(H):

    for j in range(W):

        if i != H-1:

            if s[i][j] == "." and s[i+1][j] == "#":

                dis[i+1][j] = min(dis[i][j] + 1,dis[i+1][j])

            else:
                dis[i+1][j] = min(dis[i][j],dis[i+1][j])

        if j != W-1:
            if s[i][j] == "." and s[i][j+1] == "#":

                dis[i][j+1] = min(dis[i][j] + 1,dis[i][j+1])

            else:
                dis[i][j+1] = min(dis[i][j],dis[i][j+1])

print (dis[-1][-1])


### FIXED CODE ###

#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,cos,radians,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
s=list(map(int,SI()))
if n==1:
    print(s[0])
    sys.exit()

def divi2(x):
    if x%2==1:
        return 0
    else:
        count=0
        while x%2==0:
            x//=2
            count+=1
        return count
#print(divi2(24))
pw2=[0 for i in range(n-1)]
for i in range(n-1):
    if i%2==1:
        pw2[i]=divi2(i+1)
#print(pw2)
#print(s)
cmbnk2=[0 for i in range(n)]
for i in range(n-1):
    cmbnk2[i+1]=cmbnk2[i]+pw2[n-2-i]-pw2[i]
#print(cmbnk2)
ans=0
'''if (s.count(1)==1 and not 2 in s ) or (s.count(3)==1 and not 2 in s ):
    ans=2
    print(ans)
    sys.exit()'''
if not 2 in s:
    for i in range(n):
        s[i]=(s[i]-1)//2
    for i in range(n):
        if cmbnk2[i]==0:
            ans+=s[i]%2
    if ans%2==0:
        print(0)
    else:
        print(2)
    sys.exit()
    
        
else:
    for i in range(n):
        if cmbnk2[i]==0:
            ans+=s[i]%2
            #print(s[i]%2)
        #print(cmbnk2[i]%2+1)
        #print(s[i])
print(ans%2)
INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque

def main():
    s = list(input())
    k = int(input())
    for i in range(len(s)):
        if s[i] == 'a':
            continue
        if k >= ord('z') - ord(s[i]) + 1:
            k -= ord('z') - ord(s[i]) + 1
            s[i] = 'a'
            if k == 0:
                break
    
    if k > 0:
        s[-1] = chr(ord(s[-1]) + k)
    
    print(''.join(s))
if __name__ == '__main__':
    main()


### FIXED CODE ###

INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque

def main():
    s = list(input())
    k = int(input())
    for i in range(len(s)):
        if s[i] == 'a':
            continue
        if k >= ord('z') - ord(s[i]) + 1:
            k -= ord('z') - ord(s[i]) + 1
            s[i] = 'a'
            if k == 0:
                break
    
    if k > 0:
        s[-1] = chr((ord(s[-1]) + k - 97)%26 + 97)
    
    print(''.join(s))
if __name__ == '__main__':
    main()
#!/usr/bin/env python
# DP解

x = int(input())
dp = [False for _ in range(x+1)]
dp[0] = True
for i in range(1, 100):
    dp[i] = False
for i in range(100, x+1):
    tmp = False
    for j in range(6):
        if i-(100+j) >= 0:
            tmp = (tmp or dp[i-(100+j)])
    if tmp:
        dp[i] = True
    else:
        dp[i] = False

if dp[x]:
    print(1)
else:
    print(0)


### FIXED CODE ###

#!/usr/bin/env python

x = int(input())

n = x//100

for i in range(n+1):
    tmp = x 
    tmp -= i*100
    if 5*i >= tmp:
        print(1)
        exit()
print(0)
import collections
n = int(input())
s=[input() for i in range(n)]
ans = list()


c = collections.Counter(s)
k = c.most_common()


if n == 1:
    print(s[0])
elif n >= 2 and len(c.keys()) == 1:
    print(c.most_common()[0][0])
for i in range(k):
    if k[0][0] == k[i][1]:
        ans.append(k[i][0])
    else:
        break
        
ans = sorted(ans)
[print(i) for i in ans]

### FIXED CODE ###

import collections
n = int(input())
s=[input() for i in range(n)]
ans = list()

c = collections.Counter(s)

m = max(c.values())
for k,v in c.items():
    if v ==m:
        ans.append(k)
ans.sort()
print(*ans,sep="\n")
a = input().split()

N = int(a[0])
S = a[1]

alpha_dict = {chr(c): i+1 for i, c in enumerate(range(ord('A'), ord('Z')+1))}

st =""
o = []
for c in S:
    # print(c)
    n = alpha_dict[c]
    n = n + 2
    if (n > 26):
        n = n - 26
    # print(n)
    keys = [k for k, v in alpha_dict.items() if v == n]
    st += str(keys[0])
    #o.append(keys)
    # print(alpha_dict[n])


print(st)

### FIXED CODE ###

a = input()
b = input()

N = int(a)
S = b

alpha_dict = {chr(c): i+1 for i, c in enumerate(range(ord('A'), ord('Z')+1))}

st =""

for c in S:
    n = alpha_dict[c]
    n = n + N
    if (n > 26):
        n = n - 26
    keys = [k for k, v in alpha_dict.items() if v == n]
    st += str(keys[0])
    
print(st)
while 1:
   x,y = map(int, raw_input().split())
   if x == '0' and y == '0':
      break
   else:
      if x >= y:
         print 'y x'
      else:
         print 'x y'
   

### FIXED CODE ###

while True:
   x,y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   if x >= y:
      print '%s %s' % (y, x)
   else:
      print '%s %s' % (x, y)
def lcs_size():
  X = input()
  Y = input()
  
  a = len(X)
  b = len(Y)
  
  c = [[0 for i in range(a+1)] for j in range(b+1)]
  maxl = 0
  for i in range(a):
    for j in range(b):
      if X[i] == Y[j]:
        c[i+1][j+1] = c[i][j] + 1
      elif c[i+1][j+1] < c[i][j+1]:
        c[i+1][j+1] = c[i][j+1]
      maxl = max(maxl, c[i+1][j+1])
  
  return maxl

q = input()

for i in range(q):
  print lcs_siz()

### FIXED CODE ###

def lcs_size():
  X = raw_input()
  Y = raw_input()
  a = len(X)
  b = len(Y)
  z2 = [0 for i in range(b+1)]

  for i in range(a):
    ch = X[i]
    z1 = z2 + []
    for j in range(b):
      if ch == Y[j]:
        z2[j+1] = z1[j] + 1
      elif z2[j+1] < z2[j]:
        z2[j+1] = z2[j]

  return z2[-1]

q = input()
for k in range(q):
  print lcs_size()
from math import sqrt

def main():

    x1, y1, x2, y2 = map(int, input().split())
    print(sqrt(abs(x2-x1)**2 + abs(y2-y1)**2))


main()

### FIXED CODE ###

from math import sqrt

def main():

    x1, y1, x2, y2 = map(float, input().split())
    print(sqrt(abs(x2-x1)**2 + abs(y2-y1)**2))


main()
N,T=map(int,input().split())
ct=[0]*N
cost=[]
for i in range(N):
  ct[i]=list(map(int,input().split()))
  if ct[i][1]<T :
    cost.append(ct[i][0])
print(min(cost))

### FIXED CODE ###

N,T=map(int,input().split())
ct=[0]*N
cost=[]
for i in range(N):
  ct[i]=list(map(int,input().split()))
  if ct[i][1]<=T :
    cost.append(ct[i][0])
if cost==[] :
  print("TLE")
else :
  print(min(cost))
x,y = input().split()
x = int(x)
y = int(y)
while True:
    if x < y:
        print(y,x)
    else x > y:
        print(x,y)
    if x==0 and y==0:
        break
    


### FIXED CODE ###


while True:
    x,y = input().split()
    x = int(x)
    y = int(y)
    if x==0 and y==0:
        break
    elif x<y:
        print(x,y)
    elif x>=y:
        print(y,x)
S=input()

S_l=S.split('/')

if int(S_l[1]>4:
       print('TBD')
else:
       print('Heisei')

### FIXED CODE ###

S=input()

S_l=S.split('/')

if int(S_l[1])>4:
       print('TBD')
else:
       print('Heisei')
nim = int(input())
for i in range(1,10):
    if nim%i == 0:
        mike = nim//i
if mike <= 9:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b = map(int, (input().split()))
print(a * b if a <= 9 and b <= 9 else -1)
K = int(input())
N = int(input())

A = list(range(N))

for i in range(N):
    A[i]=int(input())
    
max = 0

for i in range(N-1):
    if max < A[i+1]-A[i]:
        max = A[i+1]-A[i]

if max < K-A[N-1]+A[0]:
    max = K-A[N-1]+A[0]
    
print(K-max)

### FIXED CODE ###

K,N = map(int,input().split())
A = list(map(int,input().split()))
    
max = K-A[-1]+A[0]
 
for i in range(N-1):
    if max < A[i+1]-A[i]:
        max = A[i+1]-A[i]
    
print(K-max)
from collections import Counter

N,V = map(int,input().split())
cnt = 0

a = tuple(map(int,input().split()))
b = tuple(map(int,input().split()))
c = tuple(map(int,input().split()))
d = tuple(map(int,input().split()))

ab = Counter(ai+bi for ai in a for bi in b)
cd = Counter(ci+di for ci in c for di in d)

cnt = sum(ab[v-i]*t for i,t in cd.items() if v-i in ab)

print(cnt)

### FIXED CODE ###

from collections import Counter

N,V = map(int,input().split())
cnt = 0

a = tuple(map(int,input().split()))
b = tuple(map(int,input().split()))
c = tuple(map(int,input().split()))
d = tuple(map(int,input().split()))

ab = Counter(ai+bi for ai in a for bi in b)
cd = Counter(ci+di for ci in c for di in d)

cnt = sum(ab[V-i]*t for i,t in cd.items() if V-i in ab)

print(cnt)
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
b = np.abs(a)
b = sorted(a,reverse = True)
b_k = b[k-1] 
a_new = [a[_] for _ in range(len(a)) if np.abs(a)[_] >= b_k]
a_new.sort()
D = [[a_new[i+j-k] for j in range(k)] for i in range(len(a_new))]
A = (functools.reduce(operator.mul,D[_]) for _ in range(len(D)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
import numpy as np

N = int(input())
T = list(map(int, input().split()))
M = int(input())
for i in range(M):
    P, X = map(int, input().split())
    
    T_new = T
    T_new[P[i]] = X
    print(np.array(T_new).sum())

### FIXED CODE ###

import numpy as np

N = int(input())
T = list(map(int, input().split()))
M = int(input())
for i in range(M):
    P, X = map(int, input().split())
    
    T_new = T.copy()
    T_new[P-1] = X
    print(np.array(T_new).sum())
def next_num(n):
  if n%2:
    return 3*n+1
  else:
    return n/2

s = int(input())

n = s
for i in range(1000000):
  if n in [1,2,4]:
    print(i+4)
    break
  except:
    n = next_num(n)

### FIXED CODE ###

def next_num(n):
  if n%2:
    return 3*n+1
  else:
    return n/2

s = int(input())

n = s
for i in range(1000000):
  if n in [1,2,4]:
    print(i+4)
    break
  n = next_num(n)
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 2))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
mat = np.c_[mat, np.array(range(m))]
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(m)
res = []
for i, in mat[:, 0]:
	i = int(i)
	cnt[i] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i])))

for i in np.argsort(mat[:, 2]):
	print(res[int(i)])


### FIXED CODE ###

import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 3))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
	mat[i, 2] = i
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(n+1)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i-1] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i-1])))

for idx in np.argsort(mat[:, 2]):
	print(res[int(idx)])
import sys
from collections import deque
n = int(input())
graph = {i:[] for i in range(n)}
for i in range(n-1):
    x, y = [int(i) for i in sys.stdin.readline().split()]
    x -= 1
    y -= 1
    graph[x].append(y)
    graph[y].append(x)

memo_ls = [[None for j in range(2)] for i in range(n)]
# i番目の人がj色の時の通り数 0 : 白
cur = 0
def dfs(cur, col, last):
    if memo_ls[cur][col] is not None:
        return memo_ls[cur][col]
    next_col_num = 1 if col == 1 else 2
    _sum = 1
    cnt = 0
    for _next in graph[cur]:
        res = 0
        for next_col in range(next_col_num):
            if _next == last:
                continue
            cnt += 1
            res += dfs(_next, next_col, cur)
        _sum *= max(1, res)
    if cnt == 0:
        memo_ls[cur][col] = 1
        return 1
    res = _sum % (10 ** 9 + 7)
    memo_ls[cur][col] = res
    return res
res = dfs(0,0,-1) + dfs(0,1,-1)
print(res % (10**9+7))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n = int(input())
graph = {i:[] for i in range(n+1)}
for j in range(n-1):
    x, y = [int(i) for i in sys.stdin.readline().split()]
    x -= 1
    y -= 1
    graph[x].append(y)
    graph[y].append(x)

memo_ls = [[None for j in range(2)] for i in range(n+1)]
# i番目の人がj色の時の通り数 0 : 白
cur = 0
def dfs(cur, col, last):
    if memo_ls[cur][col] is not None:
        return memo_ls[cur][col]
    next_col_num = 1 if col == 1 else 2
    _sum = 1
    cnt = 0
    for _next in graph[cur]:
        if _next == last:
            continue
        cnt += 1
        res = 0
        for next_col in range(next_col_num):
            res += dfs(_next, next_col, cur)
        _sum *= max(1, res)
    if cnt == 0:
        memo_ls[cur][col] = 1
        return 1
    res = _sum % (10 ** 9 + 7)
    memo_ls[cur][col] = res
    return res
res = dfs(0,0,-1) + dfs(0,1,-1)
print(res % (10**9+7))
import sys
input = sys.stdin.readline

n,m = map(int,input().split())
heap = [int(i) for i in input().split()]
heap.sort()
ans = sum(heap)
ml = []

for i in range(m):
  a,b = map(int,input().split())
  ml += [b]*a
ml.sort(reverse=True)

for i in range(n):
  if ml[i] > heap[i]:
    ans += ml[i] - heap[i]
  else:
    break

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n,m = map(int,input().split())
heap = [int(i) for i in input().split()]
heap.sort()
ans = sum(heap)
ml = []
cnt = 0

for i in range(m):
  a,b = map(int,input().split())
  ml += [[b,a]]
ml.sort(reverse=True)

for i in range(m):
  for j in range(ml[i][1]):
    if ml[i][0] > heap[cnt]:
      ans += ml[i][0] - heap[cnt]
      cnt += 1
      if cnt == n:
        print(ans)
        exit()
    else:
      print(ans)
      exit()
print(ans)
A,B,C = map(int,input().split())
k = int(input())


lis = [A,B,C]
max_num = max(A,B,C)

lis.remove(max_num)

rui = 2 ** k

nibai = max_num * rui


a = lis[0]
b = lis[1]
print(a + b + nibai)



### FIXED CODE ###

a,b = map(int,input().split())

if a < b:
    print(a)

elif a > b:
    a = a - 1
    print(a)

elif a == b:
    print(a)
N = int(input())
A = [int(x) for x in input().split()]

import fractions

G = A[0]
for i in range(N):
    G = G * A[i] // fractions.gcd(G, A[i])

ans = 0
for j in range(N):
    ans += G / A[j]

print(int(ans % (10**9 +7)))

### FIXED CODE ###

from fractions import gcd
from functools import reduce
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=reduce(lambda x,y:x//gcd(x,y)*y,a)
ans=sum(map(lambda x:l//x,a))
print(ans%mod)
def main():
    lst = input().split()
    stack = []

    for i in lst :
        if i == ""+"" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x + y)

        elif i == "-" :
            x = stack.pop()
            y = stack.pop()
            stack.append(y - x)

        elif i == "*" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x * y)

        else :
            stack.append(int(i))

    print(stack.pop())


if __name__ = "__main__" :
    main()

### FIXED CODE ###

def main() :
    lst = input().split()
    stack = []
    for i in lst :
        if i == "+" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x + y)

        elif i == "-" :
            x = stack.pop()
            y = stack.pop()
            stack.append(y - x)

        elif i == "*" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x * y)

        else :
            stack.append(int(i))

    print(stack.pop())


if __name__ == "__main__" :
    main()
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [a[0]]
y = [b[0]]
for i in range(1, n):
    x.append(x[i-1] + a[i])
for i in range(1, m):
    y.append(y[i-1] + b[i])
    
t = 0
i = 0
j = 0
ans = 0
l = 0
r = 0
while i < n or j < m:
    if i < n and x[i]-l <= y[j]-r:
        t += a[i]
        l += a[i]
        i += 1
    elif j < m:
        t += b[j]
        r += b[j]
        j += 1
    if t > k:
        break
    ans += 1

print(ans)
            

### FIXED CODE ###

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [0]
y = [0]
for i in range(n):
    x.append(x[i] + a[i])
    
for i in range(m):
    y.append(y[i] + b[i])
    
i = 0
j = m
ans = 0
while i <= n and 0 <= j:
    if x[i] + y[j] <= k:
        ans = max(ans, i + j)
        i += 1
    else:
        j -= 1

print(ans)
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [0] * k
aidx = 0
bidx = 0
ans = 0
time = 0
while True:
    if aidx < n and bidx < m:
        if a[aidx] < b[bidx]:
            time += a[aidx]
            if time > k:
                break
            aidx += 1
            ans += 1
        else:
            time += b[bidx]
            if time > k:
                break
            bidx += 1
            ans += 1
    elif aidx < n:
        time += a[aidx]
        if time > k:
            break
        ans += 1
        aidx += 1
    elif bidx < m:
        time += b[bidx]
        if time > k:
            break
        ans += 1
        bidx += 1
    else:
        break
print(ans)

### FIXED CODE ###

n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
A = [0] * (n+1)
B = [0] * (m+1)
for i in range(1, n+1):
    A[i] = A[i-1] + a[i]
for i in range(1, m+1):
    B[i] = B[i-1] + b[i]
ans = 0
j = m
for i in range(n+1):
    while j >= 0:
        if A[i] + B[j] <= k:
            ans = max(ans, i + j)
            break
        else:
            j -= 1
print(ans)
a = [int(i) for i in input().split())]
a.sort()
print(a[2]*10+a[1]+a[0])

### FIXED CODE ###

a = [int(i) for i in input().split()]
a.sort()
print(a[2]*10+a[1]+a[0])