Harryxun/stf_run huggingface dataset:
while 1:
	x=input()
	if x=='0':
		break
	print sum(map(int,x))

### FIXED CODE ###

while 1:
	x=raw_input()
	if x=='0':
		break
	print sum(map(int,x))
while True:
 a,op,b = map(int,raw_input().split())

 if(op==*):
  x =a*b
  print x
 elif(op==/):
  x=a/b
  print x
 elif(op==+):
  x=a+b
  print x
 elif(op==-):
  x=a-b
  print x
 else:
  break
 

### FIXED CODE ###

while True:
 a,op,b = map(str,raw_input().split())
 a=int(a)
 b=int(b)

 if(op=='?'):
  break
 if(op=='+'):
  print a+b
 elif(op=='-'):
  print a-b
 elif(op=='*'):
  print a*b
 elif(op=='/'):
  print a/b
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
else:
    D = B//A-1
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)

### FIXED CODE ###

import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)
N,K=map(int,input().split())

x=list(map(int,input().split()))

xm=[]
xp=[]
x0=[]
ans=10**5+1

for i in range(N):
    xi=x[i]
    if xi<0:
        xm.append(xi)
    elif xi==0:
        x0.append(xi)
    else:
        xp.append(xi)

xm.sort(reverse=True)

if x0==[]:
    ajst=0
else:
    ajst=1

K=K-ajst

for i in range(min(len(xp),K)):
    if i<K-1:
        if len(xm)>=K-(i+1):
            ans=min(ans,2*xp[i]-xm[K-ajst-(i+1)-1])
    
    else:#i==K-1
        ans=min(ans,xp[i])

for i in range(min(len(xm),K)):
    if i<K-1:
        if len(xp)-1>=K-(i+1):
            ans=min(ans,-2*xm[i]+xp[K-ajst-(i+1)-1])
    
    else:#i==K-1
        ans=min(ans,-xm[i])

if K==１ and x0!=0:
    ans=0

print(ans)

### FIXED CODE ###

N,K=[int(i) for i in input().split()]
X=[int(i) for i in input().split()]
m=10**9
for i in range(N-K+1):
    m=min(m,X[K-1+i]-X[i]+min(abs(X[K-1+i]),abs(X[i])))

print(m)
N = int(input())
L = []
for i in range(N):
    L.append(str(input()))

list_val = list(set(L))
list_size = []
for i in list_val:
    list_size.append(L.count(i))

max_size = max(list_size)

ans = []
while max(list_size) == max_size:
    max_idx = list_size.index(max_size)
    ans.append(list_val[max_idx])
    list_size[max_idx] = 0
print("\n".join(sorted(ans))


### FIXED CODE ###

import collections

N = int(input())

s = [input() for i in range(N)]

c = collections.Counter(s)
max_n = max(c.values())

ans = []
for key, val in c.items():
  if val == max_n:
    ans.append(key)
print("\n".join(sorted(list(set(ans)))))
a, b = (int(_) for _ in input().split())  
res = float(sum([(1/2 ** (math.ceil(int(b/i)**(1/2)))) if i < b else 1 for i in range(1,a+1)]) / a)
print(res)

### FIXED CODE ###

import math
a, b = (int(_) for _ in input().split())  
res = float(sum([(1/2 ** (math.ceil(math.log2(b/i)))) if i < b else 1 for i in range(1,a+1)]) / a)
print(res)
n=input()
if n==1:
  print(1)
elif n%2==0:
  print(0.5)
else:
  print((n//2+1)/n)

### FIXED CODE ###

n=int(input())
if n==1:
  print(1)
elif n%2==0:
  print(0.5)
else:
  print((n//2+1)/n)
h,n = map(int,input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans += a[i]
if(ans>=h):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

h,n = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans += a[i]
if(ans>=h):
  print("Yes")
else:
  print("No")
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in set(a):
    temp = a.count(i)
    if temp > i:
        ans += temp - i
    elif temp < i:
        ans += i
print(ans)

### FIXED CODE ###

import math
a, b = map(int, input().split())
print(math.ceil((a+b)/2))
A, B, C = map(int, input().split())
li=[]
for i in range(1000000):
  c=A*(i+1)%B
  if c  in li:
    break
  li += c

if C in li:
  print("YES")
else:
  print("NO")




### FIXED CODE ###

A, B, C = map(int, input().split())
li=[]
for i in range(1000000):
  c=A*(i+1)%B
  if c  in li:
    break
  li.append(c)

if C in li:
  print("YES")
else:
  print("NO")
#!/usr/bin/env python3

from collections import deque


def book(A, B, t, cnt):
    if len(A) == 0 and len(B) == 0:
        return cnt
    elif t == K:
        return cnt
    elif t > K:
        return cnt - 1

    a_r = 0
    b_r = 0
    if len(A) != 0:
        a = A.popleft()
        a_r = book(A, B, t+a, cnt+1)
        
    if len(B) != 0:
        b = B.popleft()
        b_r = book(A, B, t+b, cnt+1)

    return max(a_r, b_r)




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

A = deque(A)
B = deque(B)

t = 0
ret = 0

ret = book(A, B, 0, 0)

print(ret)


### FIXED CODE ###

#!/usr/bin/env python3

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


a = [0]
b = [0]

for i in range(N):
    a.append(a[-1] + A[i])


for i in range(M):
    b.append(b[-1] + B[i])

ret = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while a[i] + b[j] > K:
        j -= 1

    ret = max(i+j, ret)


print(ret)
n,x = map(int, input().split())
l = list(map(int, input().split()))

s = 0
t = 0
for i in range(n+1):
  t += l[i]
  s += 1
  if t > x:
    break
print(s)

### FIXED CODE ###

n,x = map(int, input().split())
l = list(map(int, input().split()))

s = 1
d = 0
for i in l:
  d += i
  if d <= x:
    s += 1
print(s)
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
for i in range(N):
    l = P[:i+1]
    print(l)
    if P[i] <= min(l):
        count += 1

print(count)


### FIXED CODE ###

#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
min_prev = P[0] + 1
for i in range(N):
    if P[i] < min_prev:
        min_prev = P[i]
        count += 1

print(count)
import pandas as pd
n=int(input())
O=[]
#A=[]
#B=[]
for i in range(n):
    a,b=map(int, input().split(" "))
    O.append([2*a-b,a,b])
  
O=sorted(O, key=lambda x: x[0])[::-1]
#print(O)

count=0
for num in range(n):
    if num%2==0:
        count+=O[num][1]
    else:
        count-=O[num][2]

print(count)


### FIXED CODE ###

#import pandas as pd
n=int(input())
O=[]
#A=[]
#B=[]
for i in range(n):
    a,b=map(int, input().split(" "))
    O.append([a+b,a,b])
  
#O=sorted(O, key=lambda x: (x[0],x[1]))[::-1]
O=sorted(O, key=lambda x: (x[0]))[::-1]
#print(O)

count=0
for num in range(n):
    if num%2==0:
        count+=O[num][1]
    else:
        count-=O[num][2]

print(count)
import numpy as np
    
INF = float('inf')

n,A,B,C = [int(i) for i in input().split()]

l = [int(input()) for i in range(n)]

def dfs(cur, a, b, c):
    
    if cur == n:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a+l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b+l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c+l[cur]) + 10

    return min(ret0, ret1, ret2, ret3)


print(dfs(0,0,0,0))


### FIXED CODE ###

s = input().split("/")

if (int(s[0]) <= 2019) and (int(s[1]) <= 4) and (int(s[2]) <= 30):
    print("Heisei")
else:
    print("TBD")
n=int(input())
s=input()
k=[i for i in range(1,n+1)]
from itertools import combinations
c=list(combinations(k,3))
ans=0
for i in range(len(c)):
  p=int(c[i][0])
  q=int(c[i][1])
  r=int(c[i][2])
  if s[p]!=s[q] and s[q]!=s[r] and s[p]!=s[r] and q-p!=r-q:
    ans=ans+1
print(ans)  

### FIXED CODE ###

n=int(input())
s=list(input())
a=s.count("R")
b=s.count("G")
c=s.count("B")
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    k=2*j-i
    if n-1>=k and (s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]): 
      ans=ans+1
print(a*b*c-ans)
print(8-int((X-400)/200))

### FIXED CODE ###

X=int(input())
N=8-int((X-400)/200)
print(N)
import math
def main():
    r = [int(i) for i in input().sprit()]
    print ("%f %f" % (r ** 2 * math.pi,  2 * r * math.pi))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import math
r = float(input())

s = r * r * math.pi
l = r * 2 * math.pi

print("{0:.5f} {1:.5f}".format(s, l))
import math
a, b, n = map(int,input().split())
ans = 0

for i in range(0,B+1):
    s = math.floor(a * i / b)
    t = math.floor (i/b)
    ans = max(ans,s - a*t) 

print(ans) 

### FIXED CODE ###

a, b, n = map(int,input().split())
ans = 0
x = min(n , b-1)
print(x*a //b)
n, k = map(int, input().split())
print((n // k)**3 + (~k & 1) * (n // (k // 2) - n // k)**3)


### FIXED CODE ###

#!/usr/bin/env python3
n, k = map(int, input().split())
ans = (n // k)**3
if k % 2 < 1:
    ans += (n // (k // 2) - n // k)**3
print(ans)
n=int(input())
L=[[] for i in range(n)]
V=[]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    L[a].append(b)
    L[b].append(a)
    V.append([a,b])
k=max(len(l) for l in L)
C=[-1]*n
D=[-1]*n
def dfs(s,p=-1,d=0): #深さ優先探索(親,上の辺の色,深さ)
    c=C[s]
    for i in L[s]: #子に対して
        if i!=p: #親と一緒じゃないとき
            c=(c+1)%k
            C[i]=c
            D[i]=d
            dfs(i,s,d+1) #色をつけ、スタートを更新し、再探索

dfs(0)
print(k)
for v in V:
    if D[v[0]]>D[v[1]]:
        print(C[v[0]]+1)
    else:
        print(C[v[1]]+1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n=int(input())
L=[[] for i in range(n)]
V=[]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    L[a].append(b)
    L[b].append(a)
    V.append([a,b])
k=max(len(l) for l in L)
C=[-1]*n
D=[-1]*n
def dfs(s,p=-1,d=0): #深さ優先探索(親,上の辺の色,深さ)
    c=C[s]
    for i in L[s]: #子に対して
        if i!=p: #親と一緒じゃないとき
            c=(c+1)%k
            C[i]=c
            D[i]=d
            dfs(i,s,d+1) #色をつけ、スタートを更新し、再探索

dfs(0)
print(k)
for v in V:
    if D[v[0]]>D[v[1]]:
        print(C[v[0]]+1)
    else:
        print(C[v[1]]+1)
n = input()
k = len(n)
c = int(n[0])
if n == c + '9' * (k - 1):
    print(int(n[0]) + 9 * (k - 1))
else:
    print(int(n[0]) + 9 * (k - 1) - 1)


### FIXED CODE ###

n = input()
k = len(n)
c = n[0]
if n == c + '9' * (k - 1):
    print(int(n[0]) + 9 * (k - 1))
else:
    print(int(n[0]) + 9 * (k - 1) - 1)
mod = 7+10**9

def expo(x,n):
  ans = 1
  if x%2 == 1:
    ans = ans*x
  x = x*x
  n = n >> 1
  return ans

def fac(n):
  if not memo_f[n]:
    return (n*fac(n-1))%mod
  else:
    return memo_f[n]

def combi(n,k):
  return (((fac(n)*(expo(fac(k),mod-2)))%mod)*expo(fac(n-k)))%mod


n,k = map(int,input().split())
memo_f = [1]+[0]*n

if k == 1:
  ans = combi(n-1,k)*combi(n,k)%mod
elif k >= n:
  ans = 0
  for i in range(n):
    ans = (ans + combi(n,i)*combi(n-1,i)%mod)%mod
else:
  ans = 0
  for i in range(k+1):
    ans = (ans + combi(n,i)*combi(n-1,i)%mod)%mod
print(ans)

### FIXED CODE ###

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

mod = 10**9 + 7
l = 10**7
fac = [1]*l
facr = [1]*l

for i in range(l-1):
    fac[i+1] = fac[i]*(i+1)%mod
facr[l-1] = pow(fac[l-1],mod - 2,mod)
for i in range(1,l)[::-1]:
    facr[i-1] = facr[i]*i%mod

def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod

ans = 1
for i in range(1,min(n,k+1)):
    ans += combi(n,i)*combi(n-1,i)%mod
    ans %= mod
print(ans)
n,*a=map(int,open(0).read().split())
a.sort()
i = 0
while a:
    if a.count(a[0]) == 1:
        i+=1
    a = list(filter(lambda x: x%a[i] >0,a))
print(i)

### FIXED CODE ###

_,*a = map(int, open(0).read().split())
a.sort()
m = -~a[-1]
c = [0]*m
for i in a:
    c[i] += 1
    if c[i] > 1:
        continue
    for j in range(i * 2, m, i):
        c[j] = 2
print(sum(c[i]==1for i in a))
N = int(input())
x = [int(input()) for i in range(5)]
ans = [0]*5
if N%x[0]==0:
    ans[0] =  N//x[0]
else:
    ans[0] =  N//x[0] + 1

j = False
if x[0] == min(x):
    print(ans[0]+4)
else:

    for i in range(1,5):
        if j:
           break
        elif x[i] == min(x[i:]):
            j = True
            if (N-(x[i]*(ans[i-1]-1)))%x[i] == 0:
                ans[i] = (N-(x[i]*(ans[i-1]-1)))//x[i]
            else:
                ans[i] = (N-(x[i]*(ans[i-1]-1)))//x[i] + 1
        elif x[i] < x[i-1]:
            if (N-(x[i]*(ans[i-1]-1)))%x[i] == 0:
                ans[i] = (N-(x[i]*(ans[i-1]-1)))//x[i]
            else:
                ans[i] = (N-(x[i]*(ans[i-1]-1)))//x[i] + 1
        else
            if (N-(x[i]*(ans[i-1]-1)))%x[i] == 0:
                ans[i] = (N-(x[i-1]*(ans[i-1]-1)))//x[i]
            else:
                ans[i] = (N-(x[i-1]*(ans[i-1]-1)))//x[i] + 1


    for i in range(1, 5):
        if ans[i] == 0:
            ans[i] = 1
    
    print(sum(ans))


### FIXED CODE ###

import math
N = int(input())
x = [int(input()) for i in range(5)]


y = min(x)
print(math.ceil(N/y)+4)
[S, T] = input().split()
[A, B] = input().split()
U = input()

if U == S:
    print(f"{int(A)-1} {B}")
else:
    print(f"{A} {int(B) - 1}")

### FIXED CODE ###

[S, T] = input().split()
[A, B] = [int(x) for x in input().split()]
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)
h,n = input().split()
w = [0]*int(n)

for i in range(0,int(n)):
    w[i] = input()

for i in range(0,int(n)):
    h = int(h) - int(w[i])

if(h<=0):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

h,n = input().split()
w = input().split()

for i in range(0,int(n)):
    h = int(h) - int(w[i])

if(h<=0):
    print("Yes")
else:
    print("No")
n = int(input())
s = [input() for _ in range(n)]
dic = {}
for i in range(n):
  if s[i] not in dic:
    dic[s[i]] = 1
    else:
      dic[s[i]] += 1
max_dic_val = max(dic.values()) 
ans = []
for keys in dic.keys():
  if dic[keys] == max_dic_val: 
    ans.append(keys)
ans = sorted(ans)
for words in ans:
  print(words)

### FIXED CODE ###

n = int(input())
d = {}
for i in range(n):
    s=input()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
max_d = max(d.values())
print(*sorted([kv[0] for kv in d.items() if kv[1] == max_d]))
import numpy as np
import sys
sys.setrecursionlimit(10**5+10)

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

def checker(i):
  try:
    l1 = A[i-K+1:i:]
    b = np.prod(l1)
    i1 = A[i-K]
    i2 = A[i]
    score1 = b * i1
    score2 = b * i2
    if score1 < score2:
      ynlist.append("Yes")
    else:
      ynlist.append("No")
    checker(i + 1)
  except IndexError:
    pass

checker(K)
for i in ynlist:
  print(i)

### FIXED CODE ###

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

for i in range(K,N):
  if A[i-K] < A[i]:
    print("Yes")
  else:
    print("No")
n = int(input())
a = []
for i in range(n):
  x,y=map(int,input().split())
  a.append((x,y))
s = 0
import itertools
import math
for l in itertools.permutations(range(n)):
  for i in l:
    s += math.sqrt((a[l[i]][0]-a[l[i+1]][0])**2 + (a[l[i]][1]-a[l[i+1]][1])**2)
print(s/n)

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
  x,y=map(int,input().split())
  a.append((x,y))
s = 0
import itertools
import math
import fractions
for l in itertools.permutations(range(n)):

  for i in range(n-1):
    s += math.sqrt((a[l[i]][0]-a[l[i+1]][0])**2 + (a[l[i]][1]-a[l[i+1]][1])**2)
print(s/math.factorial(n))
from statistics import median

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0] * N

    for i in range(N):
        B[i] = A[i] - i - 1

    b = int(median(B))
    sumB = 0
    for i in range(N):
        sumB += abs(B[i] - b)

    print(sumB)


main()

### FIXED CODE ###

from statistics import median

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0] * N

    for i in range(N):
        B[i] = A[i] - i - 1

    b = int(median(B))
    sumB = 0
    for i in range(N):
        sumB += abs(B[i] - b)

    print(sumB)


main()
def main(s):
    for word in ['dream', 'dreamer', 'erase', 'eraser']:
        if delete_word(s, word):
            print('YES')
            break
    else:
        print('NO')


def delete_word(s, word):
    if s.startswith(word):
        s = s[len(word):]
        if len(s) == 0:
            return True
        for w in ['dream', 'dreamer', 'erase', 'eraser']:
            if delete_word(s, w):
                return True
    else:
        return False


if __name__ == "__main__":
    main(input())


### FIXED CODE ###

WORDS = ['dream', 'dreamer', 'erase', 'eraser']
REVERSED_WORDS = [word[::-1] for word in WORDS]


def main(s):
    i = 0
    while i < len(s):
        for word in REVERSED_WORDS:
            if s[i:].startswith(word):
                i += len(word)
                break
        else:
            print('NO')
            break
    else:
        print('YES')


if __name__ == "__main__":
    main(input()[::-1])
from scipy.special import perm

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
per = perm(n - 1, n - 1, exact=True)
r = 0
r2 = 0
for k in range(1, n)[::-1]:
    t = p[0]
    c = sum([t > x for x in p])
    r += per * c
    p.remove(t)
    t = q[0]
    c = sum([t > x for x in q])
    r2 += per * c
    q.remove(t)
    per = int(per / k)

print(int(abs(r - r2)))


### FIXED CODE ###

import math

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
per = math.factorial(n - 1)
r = 0
r2 = 0
for k in range(1, n)[::-1]:
    t = p[0]
    c = sum([t > x for x in p])
    r += per * c
    p.remove(t)
    t = q[0]
    c = sum([t > x for x in q])
    r2 += per * c
    q.remove(t)
    per = int(per / k)

print(int(abs(r - r2)))
S = input()
print("A" + a[8] + "C")

### FIXED CODE ###

S = input()
print("A" + S[8] + "C")
import numpy as np



### FIXED CODE ###

from statistics import pstdev
while input()!="0":
    lst=map(int,input().split())
    print(pstdev(lst))
N = int(input())
if N == 1:
    print('Hello World')
else:
    A, B = map(int, input().split())
    print(A+B)

### FIXED CODE ###

N = int(input())
if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)
n=int(input())
v=list(map(int,input().split()))
from collections import Counter
a=Counter(v[0::2]).most_common()
b=Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0]!=b[0][0]:
    print(n-(a[0][1]+b[0][1]))
else:
    print(min(n-(b[0][1]+a[1][1],n-(a[0][1]+b[1][1])))

### FIXED CODE ###

from collections import Counter
    
n = int(input())
v = list(map(int, input().split()))

a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0] != b[0][0]:
    print(n - (a[0][1] + b[0][1]))
else:
    print(min(n-(a[1][1]+b[0][1]), n-(a[0][1]+b[1][1])))
a = input()

if a.isupper():
	print(A)
else:
	print(a)

### FIXED CODE ###

a = input()

if a.isupper():
	print("A")
else:
	print("a")
import math
X = input().split(" ")
A = int(X[0])
B = int(X[1])
print(str(A * B // math.gcd(A,B)))

### FIXED CODE ###

from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)
n, k = map(int, input().split())
A = input().split()
B = A*k
tentosu = 0

for i in range(len(B)):
    for j in range(len(B)):
        if j <i:
            continue
        if B[i] > B[j]:
            tentosu += 1
            
ans = tentosu % (10**9 + 7)
print(ans)

### FIXED CODE ###

mod = (10 ** 9) + 7
N, K = map(int, input().split())
A = list(map(int, input().split()))

ten_f = 0
ten_l = 0

for i in range(N):
    for j in range(i + 1, N):
        if A[i] > A[j]:
            ten_f += 1

for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            ten_l += 1

ans = (ten_f * (K)) + ((K * ((K - 1)) // 2) * ten_l)
print(ans % mod)
def main():
  s = input()
  divisor = 10 ** 9 + 7
  lut = [i % 13 for i in range(133)]
  m = [i * 10 % 13 for i in range(10)]
  dp = [[0] * 13 for _ in range(len(s) + 1)]
  dp[0][0] = 1
  list10 = list(range(10))
  list13 = list(range(13))
  for i in range(len(s)):
    dpi = dp[i]
    dpi1 = dp[i + 1]
    if s[i] == '?':
      for j in list10:
        for k in list13:
          dpi1[lut[m[k] + j]] += dpi[k]
    else:
      t = int(s[i])
      for k in list13:
        dpi1[lut[m[k] + t]] += dpi[k]
    for k in range(13):
      dpi1[k] %= divisor
  print(dp[len(s)][5])
main()


### FIXED CODE ###

s = ''.join(reversed(input()))
multiplier = 1
divisor = 10 ** 9 + 7
p = [0 for i in range(13)]
if s[0] != '?':
  p[int(s[0])] = 1
else:
  for j in range(10):
    p[j] = 1
for i in range(1, len(s)):
  multiplier = (10 * multiplier) % 13
  np = [0 for j in range(13)]
  if s[i] != '?':
    r = int(s[i]) * multiplier
    for j in range(13):
      np[(j + r) % 13] = p[j]
  else:
    for j in range(10):
      r = j * multiplier
      for k in range(13):
        np[(k + r) % 13] += p[k]
  for j in range(13):
    p[j] = np[j] % divisor
print(p[5] % divisor)
from collections import deque
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

A.append(-int(1e+100))
B.append(-int(1e+100))
C.append(-int(1e+100))

Aq = deque(A)
Bq = deque(B)
Ar = [Aq.popleft()]
Br = [Bq.popleft()]
maximum = min((len(A)-1) + (len(B)-1), K)
preA = Ar[0]
preB = Br[0]

while len(Ar) + len(Br) < maximum:
    if  Ar[0] - Aq[0] > Br[0] - Bq[0]:
        Br.append(Bq.popleft())
        preB = Br[-1]
    else:
        Ar.append(Aq.popleft())
        preA = Ar[-1]

AB = [Ar[i] + Br[j] for i in range(len(Ar)) for j in range(len(Br))]
AB = sorted(AB, reverse=True)

AB.append(-int(1e+15))

ABq = deque(AB)
Cq = deque(C)
ABr = [ABq.popleft()]
Cr = [Cq.popleft()]
maximum = min((len(AB)-1) + (len(C)-1), K)
preAB = ABr[0]
preC = Cr[0]
while len(ABr) + len(Cr) < maximum:
    if ABr[0] - ABq[0] > Cr[0] - Cq[0]:
        Cr.append(Cq.popleft())
        preC = Cr[-1]
    else:
        ABr.append(ABq.popleft())
        preAB = ABr[-1]

ABC = [ABr[i] + Cr[j] for i in range(len(ABr)) for j in range(len(Cr))]
ABC = sorted(ABC, reverse=True)

for i in range(min(K)):
    print(ABC[i])


### FIXED CODE ###

from collections import deque
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

A.append(-int(1e+15))
B.append(-int(1e+15))
C.append(-int(1e+15))

Aq = deque(A)
Bq = deque(B)
Ar = [Aq.popleft()]
Br = [Bq.popleft()]
maximum = min((len(A)-1) + (len(B)-1), K+1)
preA = Ar[0]
preB = Br[0]

while len(Ar) + len(Br) < maximum:
    if  Ar[0] - Aq[0] > Br[0] - Bq[0]:
        Br.append(Bq.popleft())
        preB = Br[-1]
    else:
        Ar.append(Aq.popleft())
        preA = Ar[-1]

AB = [Ar[i] + Br[j] for i in range(len(Ar)) for j in range(len(Br))]
AB = sorted(AB, reverse=True)

AB.append(-int(1e+15))

ABq = deque(AB)
Cq = deque(C)
ABr = [ABq.popleft()]
Cr = [Cq.popleft()]
maximum = min((len(AB)-1) + (len(C)-1), K+1)
preAB = ABr[0]
preC = Cr[0]
while len(ABr) + len(Cr) < maximum:
    if ABr[0] - ABq[0] > Cr[0] - Cq[0]:
        Cr.append(Cq.popleft())
        preC = Cr[-1]
    else:
        ABr.append(ABq.popleft())
        preAB = ABr[-1]

ABC = [ABr[i] + Cr[j] for i in range(len(ABr)) for j in range(len(Cr))]
ABC = sorted(ABC, reverse=True)

for i in range(K):
    print(ABC[i])