Harryxun/stf_run huggingface dataset:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

n,x = myinput()
ans = (n-1)*3
print(ans)

### FIXED CODE ###

from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

n,x = myinput()

def mycalc(a,b):
    if b==0:
        return 0
    else:
        return ( (a//b) * 3 * b ) + mycalc(b,a%b)

ans = mycalc(n-x,x)
print(ans)
N, K = map(int, input().split())

S = input()

if N == 1:
    print(0)
    exit()
#左端をLにする場合
now = ""
num_substr = 0
ex = ""
stack = []
for i in range(N):
    if (ex == "L" or ex == "") and S[i] == "R":
        start = i
    if ex == "R" and S[i] == "L":
        end = i-1
        stack.append((start, end))
        num_substr += 1
    ex = S[i]
#左からひっくり返す
if num_substr == 0:
    print(N-1)
    exit()
tmp = min(K,num_substr,N)
num = stack[tmp-1][1]
ss = "L"*(num+1)+S[num+1:]
ll = num

for i in range(num+1,N):
    if i == 0:
        if (ss[i+1] == "R" and ss[i] == "R"):
            ll += 1
    elif i == N-1:
        if (ss[i-1] == "L" and ss[i] == "L"):
            ll += 1
    else:
        if (ss[i-1] == "L" and ss[i] == "L") or (ss[i+1] == "R" and ss[i] == "R"):
            ll += 1


#右からひっくり返す
if num_substr == 0:
    print(N-1)
    exit()
tmp = min(K,num_substr,N)
num = stack[len(stack)-tmp][0]
ss = S[:(N-1-num)]+"L"*(N-1-num)

lr = (N-1-num)

for i in range(num):
    if i == 0:
        if (ss[i+1] == "R" and ss[i] == "R"):
            lr += 1
    elif i == N-1:
        if (ss[i-1] == "L" and ss[i] == "L"):
            lr += 1
    else:
        if (ss[i-1] == "L" and ss[i] == "L") or (ss[i+1] == "R" and ss[i] == "R"):
            lr += 1


######################################################################
#左端をRにする場合
now = ""
num_substr = 0
ex = ""
stack = []
for i in range(N):
    if (ex == "R" or ex == "") and S[i] == "L":
        start = i
    if ex == "L" and S[i] == "R":
        end = i-1
        stack.append((start, end))
        num_substr += 1
    ex = S[i]
#左からひっくり返す
if num_substr == 0:
    print(N-1)
    exit()
tmp = min(K,num_substr,N)
num = stack[tmp-1][1]
ss = "R"*(num+1)+S[num+1:]
rl = num
#print(ll, tmp)
for i in range(num+1,N):
    if i == 0:
        if (ss[i+1] == "R" and ss[i] == "R"):
            rl += 1
    elif i == N-1:
        if (ss[i-1] == "L" and ss[i] == "L"):
            rl += 1
    else:
        if (ss[i-1] == "L" and ss[i] == "L") or (ss[i+1] == "R" and ss[i] == "R"):
            rl += 1


#右からひっくり返す
if num_substr == 0:
    print(N-1)
    exit()
tmp = min(K,num_substr,N)
num = stack[len(stack)-tmp][0]
ss = S[:(N-1-num)]+"R"*(N-1-num)

rr = (N-1-num)
#print(ll, tmp)
for i in range(num):
    if i == 0:
        if (ss[i+1] == "R" and ss[i] == "R"):
            rr += 1
    elif i == N-1:
        if (ss[i-1] == "L" and ss[i] == "L"):
            rr += 1
    else:
        if (ss[i-1] == "L" and ss[i] == "L") or (ss[i+1] == "R" and ss[i] == "R"):
            rr += 1


print(max([ll,lr,rl,rr]))





### FIXED CODE ###


N, K = map(int, input().split())
S = input()

ans = 0
for x,y in zip(S, S[1:]):
    if x == y: #同じ方向を見ているとき
        ans += 1
#最大K回まで操作をして、そのたびに幸福な人が二人増える。全員同じ方向を向くとN-1
ans = N-1 if ans+2*K >= N-1 else ans+2*K
print(ans)
s=list(map(int,input().split(/)))

if s[0]<=2018:
  print(Heisei)
elif s[0]=2019 and s[1]<5:
  print(Heisei)
else:
  print(TBD)


### FIXED CODE ###

s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")
m,d=map(int,input().split())
count=0
for i in range(1,m+1):
	for j in range(1,d+1):
		if d>=10:
			d1=int(str(d)[-1])
    		d2=int(str(d)[0])
    		if d1>=2 and d2>=2 and d1*d2==m:
      			count+=1
print(count)

### FIXED CODE ###

m,d=map(int,input().split())
count=0
for i in range(1,m+1):
    for j in range(1,d+1):
        if j>=10:
            d1=int(str(j)[-1])
            d2=int(str(j)[0])
            if d1>=2 and d2>=2 and d1*d2==i:
                count+=1
print(count)
from fractions import gcd
n=int(input())
t=[0]*n
ans=int(input())
for i in range(1,n):
  t=int(input())
  ans=int(ans*t/gcd(ans,t))
print(ans)

### FIXED CODE ###

from fractions import gcd
n=int(input())
ans=int(input())
for i in range(1,n):
  t=int(input())
  ans=ans*t//gcd(ans,t)
print(int(ans))
(n, x) = list(map(int, input().split()))
num = 1
pate = 1
for i in range(n):
    num = num * 2 + 3
    pate = pate * 2 + 1
def culc(l, idx, num, pate):
    npate = (pate - 1) // 2
    nnum = (num - 3) // 2
    mid = (num + 1) // 2
    if idx == 1:
        return 0
    elif mid == idx:
        return npate + 1
    elif mid < idx:
        return npate + 1 + culc(l - 1, idx - mid, nnum, npate)
    else:
        return culc(l - 1, idx - 1, nnum, npate)
print(culc(n, x, num, pate))


### FIXED CODE ###

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

num = 1
pate = 1
for i in range(n):
    num = num * 2 + 3
    pate = pate * 2 + 1

def culc(l, idx, num, pate):
    npate = (pate - 1) // 2
    nnum = (num - 3) // 2
    mid = (num + 1) // 2
    if l == 1:
        if idx == 0:
            return 0
        elif idx == 1:
            return 0
        elif idx == 2:
            return 1
        elif idx == 3:
            return 2
        elif idx == 4:
            return 3
        else:
            return 3
    elif mid == idx:
        return npate + 1
    elif mid < idx:
        return npate + 1 + culc(l - 1, idx - mid, nnum, npate)
    else:
        return culc(l - 1, idx - 1, nnum, npate)
print(culc(n, x, num, pate))
x,y=map(int,input().split())
if y%2==0 and 2*x<=y and y<=4*x:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a=list(map(int,input().split()))
count=1
for x in a:
  if x!=0:
    count+=1
  else:
    break
print(count)
N, M = map( int, input().split())
A = list( map( int, input().split()))
C = [0,2,5,5,4,5,6,3,7,6]
dp = [(0,0)]*(N+1)
for a in A:
    dp[C[a]] = (1,0)
Z = list( set( C[a] for a in A))
Z.sort()
for i in range(2,N+1):
    for z in Z:
        if i > z:
            if dp[i-z][0] == 1:
                dp[i] = (1, i-z)
                break
print("a")
# s = N
# ANS = [0]*10
# while s != 0:
#     _, b = dp[s]
#     ANS[s-b] += 1
#     s = b
# ans = ""
# for i in range(9,0,-1):
#     if ANS[C[i]] > 0:
#         if i in A:
#             ans = ans + str(i)*ANS[C[i]]
#             ANS[C[i]] = 0
# print( ans)


### FIXED CODE ###

N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*10
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    if x <= N:
        dp[x] = 1
for i in range(1,N):
    t = dp[i]
    for x in Check:
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for a in A:
        x = Needs[a]
        if t-x>=0:
            if dp[t-x]+1 == dp[t]:
                W[V[x]] += 1
                t -= x
                break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)
i = 0
n = (int)raw_input()
while !n:
  i += 1
  print 'Case {0}: {1}'.format(i,n)
  n = (int)raw_input()

### FIXED CODE ###

n = input()
i = 1
while n != 0:
  print "Case %d: %d" % (i, n)
  n = input()
  i += 1;
import numpy as np

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if np.all(num_light, n):
    break
    
print(*num_light)


### FIXED CODE ###

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break
    
print(*num_light)
n, a, b = map(int, input())
n = list(str(n))

count = 0
for j in range(n)
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)


### FIXED CODE ###

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

x = []
for j in range(1, m + 1):
    n = list(str(j))
    l = [int(n[i]) for i in range(len(n))]
    if len(l) == 1:
        l.append(0)
    s = sum(l)
    if a <= s and s <= b:
        x.append(j)
print(sum(x))
a,b,c = map(str(input().split(",")))
print(a,b,c)

### FIXED CODE ###

a = input()
A =a[0]+a[1]+a[2]+a[3]+a[4]
B =a[6]+a[7]+a[8]+a[9]+a[10]+a[11]+a[12]
C =a[14]+a[15]+a[16]+a[17]+a[18]
print(A,B,C)
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

n = i_i()
a = i_l()
print(*a[::-2],*a[n%2::2])



### FIXED CODE ###

from collections import deque

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

d = deque()
for i in range(n):
    if i % 2 != 0:
        d.append(a[i])
    else:
        d.appendleft(a[i])

if n % 2 == 0:
    print(*list(reversed(d)))
else:
    print(*d)
from itertools import accumulate
import heapq
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, W = map(int, input().split())
first_item = list(map(int, input().split()))
basew = first_item[0]
w0 = []
w1 = []
w2 = []
w3 = []
heapq.heappush(w0, first_item[1])
for _ in range(N-1):
    w, v = map(int, input().split())
    w -= basew
    if w == 0:
        heapq.heappush(w0, v)
    elif w == 1:
        heapq.heappush(w1, v)
    elif w == 2:
        heapq.heappush(w2, v)
    elif w == 3:
        heapq.heappush(w3, v)

w0_acc = [0]+list(accumulate(reversed(w0)))
w1_acc = [0]+list(accumulate(reversed(w1)))
w2_acc = [0]+list(accumulate(reversed(w2)))
w3_acc = [0]+list(accumulate(reversed(w3)))
print("acc-0", w0_acc)
print("acc-1", w1_acc)
print("acc-2", w2_acc)
print("acc-3", w3_acc)
v = 0
for i0 in range(N+1):
    for i1 in range(N+1):
        for i2 in range(N+1):
            for i3 in range(N+1):
                if basew*(i0+i1+i2+i3)+3*i3 + 2*i2 + i1 > W:
                    break
                else:
                    v = max(v, w0_acc[i0]+w1_acc[i1]+w2_acc[i2]+w3_acc[i3])
print(v)


### FIXED CODE ###

from itertools import accumulate
import heapq
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, W = map(int, input().split())
first_item = list(map(int, input().split()))
basew = first_item[0]
w0 = []
w1 = []
w2 = []
w3 = []
w0.append(first_item[1])
for _ in range(N-1):
    w, v = map(int, input().split())
    w -= basew
    if w == 0:
        w0.append(v)
    elif w == 1:
        w1.append(v)
    elif w == 2:
        w2.append(v)
    elif w == 3:
        w3.append(v)

w0_acc = [0]+list(accumulate(sorted(w0, reverse=True)))
w1_acc = [0]+list(accumulate(sorted(w1, reverse=True)))
w2_acc = [0]+list(accumulate(sorted(w2, reverse=True)))
w3_acc = [0]+list(accumulate(sorted(w3, reverse=True)))
v = 0
for i0 in range(len(w0)+1):
    for i1 in range(len(w1)+1):
        for i2 in range(len(w2)+1):
            for i3 in range(len(w3)+1):
                if basew*(i0+i1+i2+i3)+3*i3 + 2*i2 + i1 > W:
                    break
                else:
                    v = max(v, w0_acc[i0]+w1_acc[i1]+w2_acc[i2]+w3_acc[i3])
print(v)
n = int(input())
def numOfDigits(num):
    return len(str(num))
ans += 1
while n > 0:
    if numOfDigits(n)%2 == 1:
        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
def numOfDigits(num):
    return len(str(num))
ans = 0
while n > 0:
    if numOfDigits(n)%2 == 1:
        ans += 1
    n -= 1
print(ans)
MOD = 998244353


def solve(s, k):
    one_count = []
    ones = 0
    for st in s:
        if st == "1":
            ones += 1
        else:
            one_count.append(ones)
            ones = 0
    one_count.append(ones)
    m = len(one_count)
    dp = [[[0] * 300 for _ in range(300)] for __ in range(m + 1)]
    dp[0][0][0] = 1
    for i in range(m):
        c = one_count[i]
        for j in range(300):
            for p in range(300):
                dp[i][j][p] %= MOD
                for q in range(300 - max(j, p)):
                    dp[i + 1][j + q][p + q] += dp[i][j][p]
                for q in range(-c, 0):
                    dp[i + 1][j + q][p] += dp[i][j][p]

    # print(dp)
    res = sum([dp[m][0][p] for p in range(k + 1)])
    # print(res)
    return res % MOD


def main():
    s, k_ = input().split()
    k = int(k_)
    res = solve(s, k)
    print(res)


def test():
    assert solve("0101", 1) == 4
    assert solve("01100110", 2) == 14
    assert solve("1101010010101101110111100011011111011000111101110101010010101010101", 20) == 113434815


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


### FIXED CODE ###

MOD = 998244353


def solve(s, k):
    one_count = []
    ones = 0
    for st in s:
        if st == "1":
            ones += 1
        else:
            one_count.append(ones)
            ones = 0
    one_count.append(ones)
    ss = sum(one_count)
    # print(ss)
    m = len(one_count)
    dp = [[[0] * (ss + 1) for _ in range(ss + 1)] for __ in range(m + 1)]
    dp[0][0][0] = 1
    for i in range(m):
        c = one_count[i]
        for j in range(ss + 1):
            for p in range(ss + 1):
                dp[i][j][p] %= MOD
                for q in range(ss + 1 - max(j, p)):
                    dp[i + 1][j + q][p + q] += dp[i][j][p]
                for q in range(-c, 0):
                    if j + q >= 0:
                        dp[i + 1][j + q][p] += dp[i][j][p]

    # print(dp)
    res = sum([dp[m][0][p] for p in range(min(k + 1, ss + 1))])
    # print(res)
    return res % MOD


def main():
    s, k_ = input().split()
    k = int(k_)
    res = solve(s, k)
    print(res)


def test():
    assert solve("0101", 1) == 4
    assert solve("01100110", 2) == 14
    assert solve("1101010010101101110111100011011111011000111101110101010010101010101", 20) == 113434815


if __name__ == "__main__":
    test()
    main()
n = int(input())  # nは入力回数
num_list = [int(input()) for _ in range(n)]
 
a = num_list[0] / num_list[2]

if a <= num_list[1]:
  print("Yes")
else :
  print("No")
 

### FIXED CODE ###

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

ans = a/c
 
if ans <= b:
  print("Yes")
else :
  print("No")
n,k = map(int,input().split())
if n%k == 0:
    print(0)
else:
    prinnt(1)

### FIXED CODE ###

n,k = map(int,input().split())
if n%k == 0:
    print(0)
else:
    print(1)
n=int(input())
T,X,Y=0,0,0

for i in range(n):
    t,x,y=map(int,input().split())
    if abs(s-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
        print('No')
        break
    T,X,Y=t,x,y
print('Yes')

### FIXED CODE ###

N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        count += 1
    T, X, Y = t, x, y
if count==N:
    print('Yes')
else:
    print('No')
k = int(input())
sum = 0
def gcd(p,q):
  if p%q == 0:
    return q
  retrun gcd(q,p%q)
for i in range(1,k+1):
   for j in range(1,k+1):
      for k in range(1,k+1):
        sum += gcd(gcd(i,j),k)

print(sum)

### FIXED CODE ###

k = int(input())
sum = 0
def gcd(p,q):
  if p%q == 0:
    return q
  return gcd(q,p%q)
  
for i in range(1,k+1):
   for j in range(1,k+1):
      for k in range(1,k+1):
        sum += gcd(gcd(i,j),k)

print(sum)
# AOJ 1510 Independent Research
# Python3 2018.7.13 bal4u

mv = [[-1,-1,-1],[-1,-1,0],[-1,-1,1],[-1,0,-1],[-1,0,0],[-1,0,1],[-1,1,-1],[-1,1,0],[-1,1,1],
      [0,-1,-1],[0,-1,0],[0,-1,1],[0,0,-1],[0,0,1],[0,1,-1],[0,1,0],[0,1,1],
      [1,-1,-1],[1,-1,0],[1,-1,1],[1,0,-1],[1,0,0],[1,0,1],[1,1,-1],[1,1,0],[1,1,1]]
				
cno = 0
arr = [[[[0 for x in range(5)] for y in range(5)] for z in range(5)] for k in range(2)]
while True:
	n = int(input())
	if n == 0: break
	for z in range(5):
		if z > 0: input()
		for y in range(5): arr[0][z][y] = list(map(int, input()))
	a, b = [0]*27, [0]*27
	ts = list(map(int, input().split()))
	for t in ts[1:]: a[t] = 1
	ts = list(map(int, input().split()))
	for t in ts[1:]: b[t] = 1
	for j in range(n):
		for z in range(5):
			for y in range(5):
				for x in range(5):
					s = 0;
					for i in range(26):
						xx, yy, zz = x+mv[i][0], y+mv[i][1], z+mv[i][2]
						if xx >= 0 and xx < 5 and yy >= 0 and yy < 5 and zz >= 0 and zz < 5:
							s += arr[j&1][zz][yy][xx] & 1
					if arr[j&1][z][y][x] & 1: arr[1-(j&1)][z][y][x] = b[s]
					else: arr[1-(j&1)][z][y][x] = a[s]
	if cno: print()
	cno += 1
	print("Case ", cno, ":", sep='')
	for z in range(5):
		if z > 0: print()
		for y in range(5): print(*arr[n&1][z][y], sep='')
		


### FIXED CODE ###

# AOJ 1510 Independent Research
# Python3 2018.7.13 bal4u

mv = [[-1,-1,-1],[-1,-1,0],[-1,-1,1],[-1,0,-1],[-1,0,0],[-1,0,1],[-1,1,-1],[-1,1,0],[-1,1,1],
      [0,-1,-1],[0,-1,0],[0,-1,1],[0,0,-1],[0,0,1],[0,1,-1],[0,1,0],[0,1,1],
      [1,-1,-1],[1,-1,0],[1,-1,1],[1,0,-1],[1,0,0],[1,0,1],[1,1,-1],[1,1,0],[1,1,1]]
				
cno = 0
arr = [[[[0 for x in range(5)] for y in range(5)] for z in range(5)] for k in range(2)]
while True:
	n = int(input())
	if n == 0: break
	for z in range(5):
		if z > 0: input()
		for y in range(5): arr[0][z][y] = list(map(int, input()))
	a, b = [0]*27, [0]*27
	ts = input()
	if len(ts) == 0: ts = input()
	ts = list(map(int, ts.split()))
	for t in ts[1:]: a[t] = 1
	ts = list(map(int, input().split()))
	for t in ts[1:]: b[t] = 1
	for j in range(n):
		for z in range(5):
			for y in range(5):
				for x in range(5):
					s = 0;
					for i in range(26):
						xx, yy, zz = x+mv[i][0], y+mv[i][1], z+mv[i][2]
						if xx >= 0 and xx < 5 and yy >= 0 and yy < 5 and zz >= 0 and zz < 5:
							s += arr[j&1][zz][yy][xx] & 1
					if arr[j&1][z][y][x] & 1: arr[1-(j&1)][z][y][x] = b[s]
					else: arr[1-(j&1)][z][y][x] = a[s]
	if cno: print()
	cno += 1
	print("Case ", cno, ":", sep='')
	for z in range(5):
		if z > 0: print()
		for y in range(5): print(*arr[n&1][z][y], sep='')
import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

def roof(n):
    return math.ceil(n/10) * 10

def mod(n):
    return n % 10

low = map(mod, [A,B,C,D,E])
top = map(roof, [A,B,C,D,E])

low = [i for i in low if i != 0]

ans = sum(top) + min(low)
print(ans)


### FIXED CODE ###

import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

def roof(n):
    return math.ceil(n/10) * 10

def mod(n):
    return n % 10

low = map(mod, [A,B,C,D,E])
top = map(roof, [A,B,C,D,E])

low = [i for i in low if i != 0]

if low == []: low = [10]
ans = sum(top) + min(low) - 10
print(ans)
H, W = map(int, input().split())
C = [''] * W
for i in range(H):
    C[i] = input()

for i in range(H):
    print(C[i])
    print(C[i])

### FIXED CODE ###

H, W = map(int, input().split())
C = [''] * H
for i in range(H):
    C[i] = input()

for i in range(H):
    print(C[i])
    print(C[i])
#numpy使ってみる
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split( ))))

ans = 10**10

for i in range(-100,101):
    tmp = ((a-i)**2).sum()
    ans = min(tmp,ans)
print(ans)

### FIXED CODE ###

#numpy使ってみる
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split( ))))

ans = 10**10

for i in range(-100,101):
    tmp = ((a-i)**2).sum()
    ans = min(tmp,ans)
print(ans)
n = int(input())
satu = n//1000
if n n % 1000 == 0:
  print(0)
  quit()
ans = 1000*(satu+1)-n
print(ans)

### FIXED CODE ###

n = int(input())
satu = n//1000
if  n % 1000 == 0:
  print(0)
  quit()
ans = 1000*(satu+1)-n
print(ans)
ans = max(A, B) * (X + Y)
for i in range(2 * 10 ** 5 + 100):
    c = i // 2
    x = i * C + max(X - c, 0) * A + max(Y - c, 0) * B
    ans = min(ans, x)

print(ans)


### FIXED CODE ###

A, B, C, X, Y = map(int, input().split())

r = []

# Cピザを使わない
t1 = A * X + B * Y
r.append(t1)

# Cピザをmin(A*2, B*2)まで買う
x = min(X, Y)
ab = 2 * x
t2 = ab * C + (X - x) * A + (Y - x) * B
r.append(t2)

# Cピザで賄う
x = max(X, Y)
ab = 2 * x
t3 = ab * C
r.append(t3)

print(min(r))
# coding: utf-8

k, s = list(map(int, input().split()))

and = 0
for i in range(k + 1):
    for j in range(k + 1):
        if 0 <= s - (i + j) <= k: ans += 1

print(ans)


### FIXED CODE ###

# coding: utf-8
 
K_MAX = 2500
k, s = list(map(int, input().split()))
 
smz = [False] * (2 * K_MAX + 1)
 
for i in range(k + 1):
    if 0 <= s - i <= 2 * k: smz[s - i] = True
 
cnt = 0
for i in range(k + 1):
    for j in range(k + 1):
        if smz[i + j]:
            cnt += 1
 
print(cnt)
s=input()
l=len(s)
n=l//2
count=0
for num in range(n):
  if(s[num]==s[l-num-]):
    pass
  else:
    count+=1
print(count)

### FIXED CODE ###

s=input()
l=len(s)
n=l//2
count=0
for num in range(n):
  if(s[num]==s[l-num-1]):
    pass
  else:
    count+=1
print(count)
n,m = [int(i) for i in input().split()]
a = [[]for i in range(n)]
b = []

for i in range(m):
    c,d = [int(i)for i in input().split()]
    a =[c-1].append((d,i))
ans = [None]*m
for j,b in enumerate(a):
    b.sort()
    for k,(d,i) in enumerate(b):
        ans[i] = str(j+1).zfill(6)+str(k+1).zfill(6)
print(*ans,sep="\n")

### FIXED CODE ###

N,M=map(int, input().split())
A=[[] for i in range(N)]
 
for i in range(M):
  p,y=map(int, input().split())
  A[p-1].append((y, i))
 
X=[0]*M
for i,d in enumerate(A):
  d.sort()
  for k,(y,j) in enumerate(d):
    X[j]=str(i+1).zfill(6)+str(k+1).zfill(6)
print(*X,sep='\n')
i = 0
while 1:
    try:
         a[i] = float(raw_input())
a.sort()
print a[len(a)-1] - a[0]

### FIXED CODE ###

a=[]
while True:
    try:
        a.append(float(raw_input()))
    except:
        break

a.sort()
print a[len(a)-1] - a[0]
N,K = map(int,input().split())
S = '9'+input()+'9'
S = [int(s) for s in S]
a = S[0]
L = []
for s  in S:
    if s != a:
        L.append(1)
        a = s
    else:
        L.append(0)
        a = S[0]
for i in range(N):
    if N == 1:
        ans = 1
        break
    elif N == 2:
        ans = 2
        break
    if a != S[i]:
        for j in range(i,N):
            if sum(S[i:j]) > K*2:
                ans = j-i
                break

print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
S = input()
L = [0]
ans = 0
res = '1'
i = 0
for s in S:
    if s != res:
        L.append(i)
        i += 1
    else:
        i += 1
    res = s
L.append(i)
L.append(i)
if len(L)<=2*K+1:
    ans = N
for i in range(0,len(L)-K*2-1,2):
    ans = max(ans,L[i+K*2+1]-L[i])
print(ans)