The restaurant AtCoder serves the following five dishes:
 - ABC Don (rice bowl): takes A minutes to serve.
 - ARC Curry: takes B minutes to serve.
 - AGC Pasta: takes C minutes to serve.
 - APC Ramen: takes D minutes to serve.
 - ATC Hanbagu (hamburger patty): takes E minutes to serve.
Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.
This restaurant has the following rules on orders:
 - An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).
 - Only one dish can be ordered at a time.
 - No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.
E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

-----Constraints-----
 - A, B, C, D and E are integers between 1 and 123 (inclusive).

-----Input-----
Input is given from Standard Input in the following format:
A
B
C
D
E

-----Output-----
Print the earliest possible time for the last dish to be delivered, as an integer.

-----Sample Input-----
29
20
7
35
120

-----Sample Output-----
215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:
 - Order ABC Don at time 0, which will be delivered at time 29.
 - Order ARC Curry at time 30, which will be delivered at time 50.
 - Order AGC Pasta at time 50, which will be delivered at time 57.
 - Order ATC Hanbagu at time 60, which will be delivered at time 180.
 - Order APC Ramen at time 180, which will be delivered at time 215.
There is no way to order the dishes in which the last dish will be delivered earlier than this.

Difficulty: introductory

Starter code:

Solutions:
import math
a = []
for i in range(5):
    a.append(int(input()))
sum = 0
r =10
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r = min(r,a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+r)

from itertools import permutations

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def calc(i, h):
    return all(h[i] >= h[j] for j in range(i))


def main():
    ans = 1000
    data = [int(input()) for i in range(5)]
    for row in permutations(data, 5):
        time = 0
        for index, i in enumerate(row):
            if index == 4:
                time += i
                continue
            remain = i % 10
            if remain:
                time += i + (10-remain)
            else:
                time += i
        ans = min(ans, time)
    print(ans)



main()

from itertools import permutations
from math import ceil

times = list(int(input()) for _ in range(5))
orders = list(permutations(times, 5))
minimum = sum(ceil(time/10)*10 for time in times)

for order in orders:
    cnt = order[0]
    for i in range(1, 5):
        cnt += ceil(order[i]/10)*10
    minimum = min(minimum, cnt)
print(minimum)


from itertools import permutations
import math

T = [int(input()) for i in range(5)]

res = float("INF")
for order in permutations(T):
    total = order[0]
    for i in range(1, 5):
        total += math.ceil(order[i]/10) * 10
    res = min(res, total)
print(res)


minutes = [int(input()) for i in range(5)]
if max(m % 10 for m in minutes) != 0:
	ones_place_min = min(m % 10 for m in minutes if m % 10 != 0)
	for m in minutes:
		if m % 10 == ones_place_min:
			ones_place_min = m
			break
	minutes.remove(ones_place_min)
	minutes = [m if m % 10 == 0 else (m + 9) // 10 * 10 for m in minutes]
	minutes.append(ones_place_min)
print(sum(minutes))

l = [int(input()) for _ in range(5)]
from operator import itemgetter
for i in range(5):
  l[i] += 9
  l[i] = str(l[i])
l.sort(key = itemgetter(-1), reverse = True)
for i in range(5):
  l[i] = int(l[i])
  l[i] -= 9
ans = 0
for i in range(5):
  if l[i]%10 == 0:
    ans += l[i]
  else:
    if i == 4 :
      ans += l[i]
    else:
      ans += l[i] + 10 - l[i]%10
print(ans)

foods = [int(input()) for _ in range(5)]
order_times = [food - food % 10 + 10 if food % 10 != 0 else food for food in foods]
diff = [(order_time - food) for order_time, food in zip(order_times, foods)]

print((sum(order_times) - max(diff)))


cooktime=[]
min_index=100
min=123
for i in range(5):
    cooktime.append(int(input('')))
    if cooktime[i]%10!=0 and min>cooktime[i]%10:
        min_index=i
        min=cooktime[i]%10
sum=0
for i in range(5):
    sum+=cooktime[i]
    if i!=min_index and cooktime[i]%10!=0:
        sum+=10-cooktime[i]%10
print((str(sum)))    
#print("min_index:"+str(min_index))


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

b=[]
c=[]

for i in range(5):
  p=math.ceil(a[i]/10)*10
  b.append(p)
  c.append(list(str(a[i]-1)))

d=[]
for i in range(5):
  d.append(int(c[i][-1]))

print(sum(b)-(10-min(d)-1))  

import math as mt
a=[int(input()) for i in range(5)]
for i in range(5):
    if a[i]%10!=0 and a[i]%10<a[0]%10:
        a[0],a[i]=a[i],a[0]
t=[mt.ceil(a[i]/10)*10 for i in range(1,5)]
print(a[0]+sum(t))

a = []
for _ in range(5):
    a.append(int(input()))
c = 0
d = 0
for i in range(5):
    b = a[i] % 10
    if b != 0 and abs(10 - b) > c:
        c = abs(10 - b)
        d = i
e = a.pop(d)
f = 0
for j in a:
    g = j % 10
    if g == 0:
        f += j
    else:
        f += (j // 10 + 1) * 10
f += e
print(f)

import math

dishes = []
rest = 10

for i in range(5):
    n = int(input())
    dishes.append(math.ceil(n / 10) * 10)
    if 0 < n % 100 % 10 < rest:
        rest = n % 100 % 10 

print(sum(dishes) - (10- rest))

N = 5
A = [int(input()) for _ in range(N)]
 
if A[0] % 10 == 0 and A[1] % 10 == 0 and A[2] % 10 == 0 and A[3] % 10 == 0 and A[4] % 10 == 0:
  ans = sum(A)
else:
  ans = 0
  B = []
  for i in range(N):
    if A[i] % 10 == 0: ans += A[i]
    else: B.append(A[i])

  C = [k % 10 for k in B]
  m = C.index(min(C))
  for i in range(len(B)):
    if i == m: ans += B[i]
    else: ans += (B[i] // 10 + 1) * 10
  
print(ans)

A = []
for i in range(5):
  A.append(int(input()))
import itertools
per = list(itertools.permutations(range(5)))
ans = []
check = 0
for k in per:
  time = 0
  for i in range(5):
    s = k[i]
    time += A[s]
    temp  = time // 10
    if time % 10 != 0 and i != 4:
      time = (temp+1) * 10
  ans.append(time)
print(min(ans))

from math import ceil
orders = list(int(input()) for _ in range(5))
total = 0
maximum = 0

for order in orders:
    time = ceil(order / 10) * 10
    total += time
    delta = time - order
    maximum = max(maximum, delta)
print((total - maximum))




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

mod = 10
l_div = [(10-x%10)%mod for x in l]
sub = max(l_div)


ans = sum(l)+sum(l_div)-sub
print(ans)



dish=[int(input()) for i in range(5)]
dish_s=[(dish[i]+9)//10 for i in range(5)]
dish_d=[dish[i]%10 for i in range(5)]
sum=0
for i in range(5):
  sum+=dish_s[i]
m=0
for i in range(5):
  if dish_s[i]*10-dish[i]>m:
    m=dish_s[i]*10-dish[i]  
print(sum*10-m)

details = []
for i in range(5):
    details.append(int(input()))
new_list = []
for i in range(10):
    current = 10 - i
    for numbers in details:
        if (((numbers - current) % 10) == 0):
            new_list.append(numbers)
counter = 0
for numbers in new_list[:len(new_list)-1]:
    current = numbers
    while ((current % 10 != 0)):
        current += 1
    counter += current

print(counter + new_list[-1])

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

diff=0
num=0
for i in l:
  if i%10==0:
    num+=i
  else:
    a=round(i+5,-1)
    num+=a
    diff=max(diff,a-i)

print(num-diff)

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=[a,b,c,d,e]
data=[0]*5
for i in range(5):
  if f[i]%10==0:
    continue
  else:
    data[i]=10-f[i]%10
print(a+data[0]+b+data[1]+c+data[2]+d+data[3]+e+data[4]-max(data))

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

def f(x):
    if 1 <= x and x <= 10:
        return 10
    elif 11 <= x and x <= 20:
        return 20
    elif 21 <= x and x <= 30:
        return 30
    elif 31 <= x and x <= 40:
        return 40
    elif 41 <= x and x <= 50:
        return 50
    elif 51 <= x and x <= 60:
        return 60
    elif 61 <= x and x <= 70:
        return 70
    elif 71 <= x and x <= 80:
        return 80
    elif 81 <= x and x <= 90:
        return 90
    elif 91 <= x and x <= 100:
        return 100
    elif 101 <= x and x <= 110:
        return 110
    elif 111 <= x and x <= 120:
        return 120
    else:
        return 130
    
aa = a + f(b) + f(c) + f(d) + f(e)
bb = b + f(c) + f(d) + f(e) + f(a)
cc = c + f(d) + f(e) + f(a) + f(b)
dd = d + f(e) + f(a) + f(b) + f(c)
ee = e + f(a) + f(b) + f(c) + f(d)
print(min(aa, bb, cc, dd, ee))

a = []
b = []
c = []
for i in range(5):
  a.append(int(input()))
for i in a:
  b.append(i%10)
for i in b:
  c.append((10-i)%10)
d = max(c)
print((sum(a)+sum(c)-d))
  


time = [int(input()) for _ in range(5)]
new_time = []
amari = 10
for x in time:
  if x % 10 == 0:
    new_time.append(x)
  else:
    amari = min(amari,x % 10)
    new_time.append(10*((x//10)+1))
    
total = sum(new_time)
dead = 10-amari

print((total-dead))
    
    
    
  


import math
import numpy as np

time_list = []
for i in range(5):
  time_list.append(int(input()))

r_list = []
for i in time_list:
  r_list.append((i-1) % 10)

x = np.argmin(r_list)
for i in range(5):
  if i != x:
    time_list[i] = int(math.ceil(time_list[i]*0.1) * 10)
print(sum(time_list))

import sys
a = list(sys.stdin.read().split())
t = list(zip(*[[int(n[:-1] or 0), int(n[-1])] for n in a]))
print((sum(t[0]) + len((u := sorted(filter(lambda n: n > 0, t[1])))[:0:-1])) * 10 + (u and u[0] or 0))

abcde = [int(input()) for _ in range(5)]

s = list(map(lambda x: (10-x%10)%10, abcde))
print(sum(abcde)+sum(s)-max(s))

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    menu=[]
    np_menu=[]
    [menu.append(int(input())) for _ in range(5)]
    np_menu=np.array(menu)
    s_menu=sorted(np_menu,key=lambda x:x%10)
    time_counter=0
    last_add=0

    for time in s_menu:
        if time % 10 ==0:
            time_counter+=time
        elif last_add==0:
            last_add+=time
        else:
            tmp=10-(time%10)
            time_counter+=time+tmp
    time_counter+=last_add
    print(time_counter)

def __starting_point():
    main()
__starting_point()

times = [input() for _ in range(5)]

res = 0
for i in times:
  res += (int(i)//10)*10+(10 if i[-1] != "0" else 0)
  
time = []
for j in times:
  time.append((int(j[-1]) if j[-1] != "0" else 10))
  
print(res - 10 + min(time))

from itertools import permutations
ls=[int(input()) for _ in range(5)]
ans = 1000000
for p in permutations(ls):
    t = 0
    for x in p[:-1]:
        t += x
        if t % 10 != 0:
            t += 10-(t%10)
    t += p[-1]
    ans = min(ans,t)
print(ans)

foods = [int(input()) for _ in range(5)]

last = foods.pop(foods.index(min(foods, key=lambda x: (x - 1) % 10)))
print(sum(map(lambda x: ((x + 9) // 10) * 10, foods)) + last)

t=[]
aa=10
for i in range(5):
    x=int(input())
    y=(x-1)%10
    aa=min(aa,y)
    for i in range(14):
        if 10*i>=x:
            t.append(10*i)
            break
print(sum(t)-10+aa+1)

# ABC123
# Five Dishes
#B=A R=B G=C P=D T=E
Ryori = [input() for _ in range(5)]
O = []
t = 0
for i in Ryori:
    if int(i[-1]) == 0:
        x = Ryori.pop(Ryori.index(i))
        O.append(x)
Ryori = sorted(Ryori,key=lambda x: x[-1], reverse=True)

for i in range(len(Ryori)-1):
    for j in range(10):
        if (int(Ryori[i]) + j) % 10 == 0:
            t += int(Ryori[i]) + j
t += int(Ryori[-1])

for i in O:
    t += int(i)
print(t)


a = [int(input()) for i in range(5)]
b = [9 - (i - 1) % 10 for i in a]
print(sum(a) + sum(b) - max(b))

dishes = [int(input()) for i in range(5)] 

d = [abs(d % 10 -10) for d in dishes if d % 10 != 0] # select nums which can be divided by 10
if d: d.remove(max(d)) 
print(sum(dishes) + sum(d))

A = []
min_digit = 9
for _ in range(5):
  s = input()
  n = int(s)
  digit = int(s[-1])
  if digit > 0 and digit < min_digit:
    min_digit = digit
    A = A + [n]
  else:
    A = [n] + A
    
import math as m
A = [int(m.ceil(n/10)*10) for n in A[:-1]] + [A[-1]]
print(sum(A))

Min = 10
total = 0
for i in range(5):
    time = input()
    time = "000" + time
    if time[-1] == "0":
        pass
    else:
        if Min > int(time[-1]):
            Min = int(time[-1])
        time = time[:-1] + "0"
        if time[-2]:
            time = time[-3] + str(int(time[-2]) + 1) + time[-1]
        else:
            time = "10"
    total += int(time)
total -= 10 - Min
print(total)

data = [int(input()) for i in range(5)]
if all(i % 10 == 0 for i in data):
    print((sum(data)))
else:
    a = 10
    for i in range(len(data)):
        if data[i] % 10 != 0:
            if a > data[i] % 10:
                a = data[i] % 10
                b = i
    ans = 0
    for i in range(len(data)):
        if i != b:
            if data[i] % 10 != 0:
                ans += (data[i] // 10 + 1) * 10
            else:
                ans += data[i]
        else:
            ans += data[i]
    print(ans)


foods = [int(input()) for i in range(5)]
loss = [0]*5
for i in range(5):
    if int(str(foods[i])[-1]) % 10 == 0:
        loss[i] = 0
    else:
        loss[i] = abs(10 - int(str(foods[i])[-1]))

lind = loss.index(max(loss))
lmax = foods[lind]
del foods[lind], loss[lind]
foods = [foods[i] + loss[i] for i in range(4)]
print((sum(foods) + lmax))


import math

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

num = 10
for i in [int(A[-1]), int(B[-1]), int(C[-1]), int(D[-1]), int(E[-1])]:
    if i != 0:
        num = min(num, i)

result = (math.ceil(int(A)/10) + math.ceil(int(B)/10) + math.ceil(int(C)/10) + math.ceil(int(D)/10) + math.ceil(int(E)/10)) * 10
if num != 10:
    result = result - 10 + num

print(result)

foods = [0] * 5
sumfoods = 0
for i in range(5):
  foods[i] = int(input())
maxDiv = 0
for i, var in enumerate(foods):
  temp = 10 - (var % 10)
  if temp == 10:
    temp = 0
  foods[i] += temp
  sumfoods += foods[i]
  if maxDiv < temp:
    maxDiv = temp
print((sumfoods - maxDiv))


n=5
r=0
rem=10
import math
for _ in range(n):
  a=int(input())
  if a%10!=0:
    rem=min(rem,a%10)
  r+=math.ceil(a/10)

#print(rem)
print((int(r*10)-10+rem))


a = [int(input()) for _ in range(5)]
z,ans = 123,0
for i in a:
    if i%10!=0:z = min(z,i%10)
    ans += 10*((i+10-1)//10)
print(ans+z-10 if (z!=123) or (z==0) else ans)

a_list=[int(input()) for i in range(5)]

sum=0
for i in a_list:
    #print(((i+9)//10)*10)
    sum+=((i+9)//10)*10

ans_list=[]
for i in a_list:
    b=((i+9)//10)*10-i
    ans_list.append(sum-b)
    
print(min(ans_list))

Value = [int(input()) for _ in range(5)]
amari = list()
for i in range(5):
  if(Value[i]%10 == 0):
    amari.append(10)
  else:
    amari.append(Value[i]%10)
min_amari = [i for i in range(5) if(min(amari)==amari[i])]

ans = 0
for i in range(5):
  if(i == min_amari[0]):
    ans += 0
  else:
    ans += (Value[i] + 10-amari[i])
ans += Value[min_amari[0]]
print(ans)

# 38
menu = []
jissai_menu = []
for i in range(5):
    menu.append(int(input()))
    if menu[i] % 10 == 0: 
        jissai_menu.append(menu[i])
    else:
        jissai_menu.append(menu[i] - menu[i] % 10 + 10)

ans = float('inf')
for i in range(5):
    tmp = 0
    for j in range(5):
        if j == i: continue
        tmp += jissai_menu[j]
    ans = min(ans, tmp + menu[i])

print(ans)

duration = [0] * 5
duration[0] = int(input())
duration[1] = int(input())
duration[2] = int(input())
duration[3] = int(input())
duration[4] = int(input())

digit = list(map(lambda x: x % 10, duration))
if any(x != 0 for x in digit):
    least = min([x for x in digit if x != 0])
    idx = digit.index(least)
else:
    idx = 0

ans = 0
for i in range(5):
    if i != idx:
        ans += ((duration[i] + 9) // 10) * 10
    else:
        ans += duration[i]

print(ans)

abcde=[int(input()) for i in range(5)]
ans=0
m=10
for i in abcde:
  ans += (i+9)//10*10
  m=min(m,(i-1)%10+1)
print(ans-10+m)

l = []
for i in range(5):
    l.append(int(input()))
amari = []
for i in range(5):
    if 10-l[i]%10 == 10 :
        amari.append(0)
    else :
        amari.append(10-l[i]%10)
jikan = []
for i in range(5):
    if amari[i] == 10:
        jikan.append(l[i])
    else :
        jikan.append(l[i] + amari[i])

print((sum(jikan)-max(amari)))


from itertools import permutations
import math
INF = float('inf')
menu = 5
times = [int(input()) for i in range(menu)]
orders = list(permutations(times, menu))
minimum = INF
for order in orders:
    total = order[0]
    for i in range(1, menu):
        total += math.ceil(order[i]/10)*10
    minimum = min(minimum, total)
print(minimum)

import sys
import copy
import math
import itertools
import numpy as np
l = [int(input()) for c in range(5)]
#10で割った余りが1以上で最も小さいものを探す
tmp = 0
cnt = 5
for i in range(5):
    if tmp < 10 - l[i]%10 and l[i]%10!=0:
        tmp = 10 - l[i]%10
        cnt = i
res = 0
for i in range(5):
    if cnt == i:
        res+=l[i]
    else:
        if l[i]%10==0:
            res+=l[i]
        else:
            res+=l[i]+10-l[i]%10

print(res)

from itertools import permutations
from math import ceil

times = [int(input()) for _ in range(5)]
orders = list(permutations(times))
minimum = sum(ceil(time/10)*10 for time in times)

for order in orders:
    total = order[0]
    for i in range(1, 5):
        total += ceil(order[i]/10)*10
    minimum = min(minimum, total)
print(minimum)



a = input()
b = input()
c = input()
d = input()
e = input()
li = []

li.append(10 - int(a[-1]))
li.append(10 - int(b[-1]))
li.append(10 - int(c[-1]))
li.append(10 - int(d[-1]))
li.append(10 - int(e[-1]))

while 10 in li: li.remove(10)

li.sort()
n = len(li)
if n != 0: 
    li.pop(n-1)

print(int(a)+int(b)+int(c)+int(d)+int(e)+sum(li))

import itertools

arr = []
mins = []

for _ in range(5):
    arr.append(int(input()))

for comb in list(itertools.permutations(arr)):
    ans = 0
    for (i, ele) in enumerate(comb):
        ans += ele
        if not i == len(comb) - 1:
            diff = 10 - (ans % 10)
            if diff == 10:
                diff = 0
            ans += diff
    mins.append(ans)

print(min(mins))

x = [int(input()) for i in range(5)]
tmp1 = []
for i in range(5):
    tmp2 = str(x[i])
    tmp1.append(int(tmp2[-1]))
for i in range(5):
    if tmp1[i] == 0:
        tmp1[i] = 10
m = tmp1.index(min(tmp1))
ans = 0
for i in range(5):
    if i == m:
        continue
    elif tmp1[i] == 10:
        ans += x[i]
    else:
        ans += (x[i] + (10 - tmp1[i]))
print(ans+x[m])

import itertools
a=[int(input()) for _ in range(5)]
cases=itertools.permutations([x for x in range(5)])
ans=1000
for case in cases:
    time=0
    for i in range(5):
        if time%10!=0:
            time+=10-time%10
        time+=a[case[i]]
    ans=min(ans,time)
print(ans)


from itertools import permutations
from math import ceil

times = list(int(input()) for _ in range(5))
orders = list(permutations(times, 5))
minimum = sum(ceil(time/10)*10 for time in times)

for order in orders:
    total = order[0]
    for i in range(1, 5):
        total += ceil(order[i]/10)*10
    minimum = min(minimum, total)
print(minimum)


l = []
ans = 0
for i in range(5):
    x = int(input())
    ans +=x
    if x%10 == 0:
        l.append(0)
    else:
        l.append(10-x%10)
l.sort()
ans +=  sum(l[:4])
print(ans)

import math
a = [int(input()) for i in range(5)]
sum = 0
r =10
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r = min(r,a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+r)

ls=[]
for i in range(5):
  ls.append(int(input()))
rm=10
time=0
for i in ls:
  if i%10==0:
    time+=i
  else:
    time+=(i//10+1)*10
    rm=min(rm,i%10)
time+=rm-10
print(time)


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
i = j = k = l = m = 0
while i*10 < A:
  i = i+1
while j*10 < B:
  j = j+1
while k*10 < C:
  k += 1
while l*10 < D:
  l = l+1
while m*10 < E:
  m = m+1
a = (i+j+k+l+m)*10
s = [int(str(A)[-1]),int(str(B)[-1]),int(str(C)[-1]),int(str(D)[-1]),int(str(E)[-1])]
s_1 = [i for i in s if i != 0]
if s_1 == []:
  print(a)
else:
  num = min(s_1)
  print(a+num-10)

x = list(map(int, (input() for i in range(5))))
y = sorted(x, key= lambda x:((x+9)//10)*10-x)

s = 0
for z in y[:-1]:
  s += ((10 + z -1)//10)*10
print((s+y[-1]))


import sys
import math

a = [int(input()) for i in range(5)]
ans = 0

min = 11
check = True
for i in range(5):
    if (a[i] % 10) < min and (a[i] % 10 != 0):
        min = (a[i] % 10)
        check=False

if check:
    min = 0

b = 100

for j in range(5):

    if a[j] % 10 == min:
        b = j

value = a.pop(b)

for x in a:
    ans += int(math.ceil(x / 10.0)) * 10

ans += value
print(ans)

# -*- coding:utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
MENU = [A,B,C,D,E]

amari = 0
amari_mod = 10
ans = 0
amari_cnt = 0

for menu in MENU:
    if menu%10 < amari_mod and menu%10 != 0:
        amari = menu
        amari_mod = menu%10

for menu in MENU:
    if menu == amari and amari_cnt==0:
        ans += menu
        amari_cnt += 1
    elif menu % 10 == 0:
        ans += menu
    else:
        menu = menu - menu%10 + 10
        ans += menu

print(ans) 


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
L = [(10 - A%10)%10,(10 - B%10)%10,(10 - C%10)%10,(10 - D%10)%10,(10 - E%10)%10]
L.sort()
print(A+B+C+D+E+L[0]+L[1]+L[2]+L[3])

a = [int(input()) for _ in range(5)]
b = [(i-1) % 10  + 1 for i in a]
count = sum(((i // 10)+ (1 if i % 10 != 0 else 0))*10 for i in a)
print(count-(10-min(b)))

from decimal import Decimal, ROUND_UP

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

for i in range(len(l)):
    rl.append(int(Decimal(str(l[i])).quantize(Decimal('1E1'), rounding=ROUND_UP)))

ans = []
for j in range(len(rl)):
    num = sum(rl) - rl[j] + l[j]
    ans.append(num)

print(min(ans))

ls =[]
for i in range(5):
    ls.append(int(input()))
rm = 10
time = 0
for i in ls:
    if i % 10 == 0:
        time += i
    else:
        time += (i//10+1)*10
        rm = min(rm,i%10)
time += rm - 10
print(time)

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=[a,b,c,d,e]
f.sort()
x=0
for i in range(5):
  if f[i]%10==0:
    x=x+f[i]
  if f[i]%10!=0:
    x=x+(f[i]//10)*10+10
g=a-(a//10)*10
h=b-(b//10)*10
i=c-(c//10)*10
j=d-(d//10)*10
k=e-(e//10)*10
l=[g,h,i,j,k]
l.sort()
y=0
z=0
for i in range(5):
  if l[i]!=0:
    y=y+1
    z=i
    break
if y==0:
  print(x)
else:
  print(x-(10-l[z]))

from math import ceil
time=[int(input())for i in range(5)]
mod=[i%10 for i in time]
a=124
res=0
for i in range(len(mod)):
    if mod[i] !=0:
        a=min(a,mod[i])
if a==124:
    a=0
for i in range(5):
    if i==mod.index(a):
        res+=time[i]
    else:
        res+=ceil(time[i]/10)*10
print(res)

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
    
if a % 10 ==0:
    aa=99
    aaa = a
else:
    aa=a%10
    aaa = ((a //10 )+1)*10

if b % 10 ==0:
    bb=99
    bbb = b
else:
    bb=b%10
    bbb = ((b //10 )+1)*10

if c % 10 ==0:
    cc = 99
    ccc = c
else:
    cc=c%10
    ccc = ((c //10 )+1)*10

if d % 10==0:
    dd = 99
    ddd = d
else:
    dd = d%10
    ddd = ((d //10 )+1)*10

if e % 10==0:
    ee = 99
    eee = e
else:
    ee = e%10
    eee = ((e //10 )+1)*10

if min(aa,bb,cc,dd,ee) ==99:
    print(a+b+c+d+e)
    return

print(aaa+bbb+ccc+ddd+eee-(10-min(aa,bb,cc,dd,ee)))

import itertools
dish=[int(input()) for _ in range(5)]
dishp=list(itertools.permutations(dish,5))
#print(list(dishp))
ans=sum(dish)*10

for dp in dishp:
	temp=0
	cnt=0
	dp=list(dp)
	while len(dp)>0:
		now=dp.pop(0)
		cnt+=1
		if cnt<5:
			if now%10==0:
				temp+=now
			else:
				temp+=(now//10+1)*10
		else:
			temp+=now
			#print(temp,now)
			ans=min(ans,temp)

print(ans)

dishes = []
for i in range(5):
    dishes.append(int(input()))

wasted_times = []
for dish in dishes:
    wasted_time = (10 - (dish % 10)) % 10
    wasted_times.append(wasted_time)

wasted_times.sort()
del wasted_times[-1]

ans = sum(dishes) + sum(wasted_times)
print(ans)


ar = []
for i in range(5):
  ar.append(int(input()))
arr = [10 - i % 10 for i in ar]
for i in range(5):
  if arr[i] == 10:
    arr[i] = 0
last = arr.index(max(arr))
# print(arr)
time = 0
for i, x in enumerate(ar):
  if i != last:
    time += x + arr[i]
    # print(time)
time += ar[last]
print(time)


import sys
t=list(zip(*[[int(n[:-1] or 0),int(n[-1])] for n in (list(sys.stdin.read().split()))]))
print((sum(t[0])+len((u:=sorted(filter(lambda n:n>0,t[1])))[:0:-1]))*10+(u and u[0] or 0))

import math

a = [int(input()) for i in range(5)]
sub = 0
cnt = 0

for i in a:
    if i%10!=0 and sub<(10-i%10):
        sub = 10-i%10
    cnt += math.ceil(i/10)*10
print(cnt-sub)

l = [int(input()) for i in range(5)]
lm = l
lm = [(i+9)//10*10 for i in l]
lr = [10-i%10 if i%10!=0 else 0 for i in l]
print((sum(lm)-max(lr)))


menu = []
for i in range(5):
    menu.append(input())

mini = 10
a = 0
for i in range(5):
    m = int(menu[i][-1])
    if 1 <= m <= mini:
        mini = m
        a = i

menu = [int(s) for s in menu]
ans = 0
for i in range(5):
    if i == a:
        ans += menu[i]
    else:
        ans += -(-menu[i]//10)*10

print(ans)

A=[int(input()) for _ in range(5)]
print((sum(((x-1)//10+1)*10 for x in A)-max((10-x%10)%10 for x in A)))


from itertools import permutations
import math
menu=5
times=[int(input()) for i in range(menu)]
orders=list(permutations(times))
minimum=sum(math.ceil(time/10)*10 for time in times)
for order in orders:
    total=order[0]
    for i in range(1,menu):
        total+=math.ceil(order[i]/10)*10
    minimum=min(minimum,total)
print(minimum)

list_dish = [input() for i in range(0, 5)]
list_disit1 = [int(list_dish[i][-1]) for i in range(0, 5)]
marking = 0
min = 9
ans = 0
for i in range(0, 5):
    if list_disit1[i] != 0 and list_disit1[i] <= min:
        marking = i
        min = list_disit1[i]
for i in range(0, 5):
    if i == marking:
        ans += int(list_dish[i])
    else: ans += -(-int(list_dish[i]) // 10) * 10
print(ans)

list_x=[]
for i in range(5):
    list_x.append(int(input()))
max_dif=0
max_dif_index=0
for i in range(5):
    if (10-list_x[i]%10>max_dif) and (list_x[i]%10!=0):
        max_dif=10-list_x[i]%10
        max_dif_index=i
ans=list_x.pop(max_dif_index)
tmp=0
for i in range(4):
    tmp+=list_x.pop()
    while(tmp%10!=0):
        tmp+=1
ans+=tmp
print(ans)

import itertools
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]
ls2 = []
for i in itertools.permutations(ls,5):
  ls2.append(list(i))
minimum = 10**5
for i in ls2:
  now = 0
  for j in range(5):
    if j == 0:
      now += i[j]
    else:
      if now % 10 == 0:
        now += i[j]
      else:
        now = 10 * (now//10+1)
        now += i[j]
  if now < minimum:
    minimum = now
print(minimum)

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

a = math.ceil(A * 0.1) * 10
b = math.ceil(B * 0.1) * 10
c = math.ceil(C * 0.1) * 10
d = math.ceil(D * 0.1) * 10
e = math.ceil(E * 0.1) * 10

lst1 = [A, B, C, D, E]
lst2 = [a, b, c, d ,e]

last = 0
max_num = -1

for i, j in zip(lst1, lst2):
    if j - i  > max_num:
        last = i
        max_num = j - i

ans = 0
k = lst1.index(last)

for n in range(5):
    if n == k:
        ans += lst1[n]
    else:
        ans += lst2[n]

print(ans)

a = [int(input()) for i in range(5)]

mn = a[0] % 10
for i in a:
    if i % 10 == 0:
        continue
    mn = min(mn, i % 10)

for i in a:
    if i % 10 == mn:
        mn = i
        break


ans = 0
for i in a:
    if i == mn:
        ans += i
        mn = -1
        continue
    t = ((i + 9) // 10) * 10
    ans += t

print(ans)


def ans123(A:int, B:int, C:int, D:int, E:int):
    serch_list=[A,B,C,D,E]
    number=0
    minnum=0
    min=1
    if A%10==0 and B%10==0 and C%10==0 and D%10==0 and E%10==0:
        return A+B+C+D+E
    else:
     for i in range(5):
        x=serch_list[i]
        if x%10!=0 and -(-x//10)*10-x>=min:
            min=-(-x//10)*10-x
            number=i
            minnum=x
     del serch_list[number]
    return -(-serch_list[0]//10)*10+-(-serch_list[1]//10)*10+-(-serch_list[2]//10)*10+-(-serch_list[3]//10)*10+minnum

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
print((ans123(A,B,C,D,E)))


ans=0
t=[]
tmp=10
for i in range(5):
    t.append(int(input()))
    if t[i]%10!=0 and t[i]%10<tmp:
        tmp=t[i]%10
#print(tmp)
flg=0
for i in range(5):
    if (t[i]%10!=tmp or flg==1) and t[i]%10==0:
        ans+=t[i]
    elif (t[i]%10!=tmp or flg==1) and t[i]%10!=0:
        ans+=(t[i]//10+1)*10
    elif t[i]%10==tmp and flg==0:
        ans+=t[i]
        flg=1
print(ans)


import sys
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a, b, c, d, e]
ans = 1 <<10
for i in itertools.permutations(lst, 5):
    cnt = 0
    for num, j in enumerate(i):
        if num == 4:
            cnt += j
            break
        if j%10 != 0:
            cnt += 10 * (j//10) + 10
        else: cnt += j
    ans = min(ans, cnt)

print(ans)




import math
L = []
S = []
for i in range(5):
    t = int(input())
    L.append(t)
    S.append(int(str(t)[-1]))

ans = 0

if max(S) == 0:
    for i in range(5):
        ans += int(math.ceil(L[i]/10)*10)
    print(ans)
else:
    if 0 in S:
        S.remove(0)
    j = S.index(min(S))
    for i in range(5):
        if i == j:
            ans += L[i]
        else:
            ans += int(math.ceil(L[i]/10)*10)
    print(ans)


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

l=[A,B,C,D,E]
tot = 0
for i in l:
  tot+=-(-i//10)*10
  
a=max(map(lambda x: -(-x//10)*10-x, l))

print(tot-a)

a = [int(input()) for _ in range(5)]
z = 123
ans = 0
for i in a:
    if i%10!=0:z = min(z,i%10)
    ans += 10*((i+10-1)//10)
print(ans+z-10 if (z!=123) or (z==0) else ans)

import math
s = 0
m = 10
for i in range(5):
  n = int(input())
  if n % 10 != 0:
    m = min(m, int(str(n)[-1]))
    
  s += math.ceil( n * 0.1 )
if m % 10 != 0:
  s +=  m * 0.1 - 1
print((int(s*10)))


list_x=[]
for i in range(5):
    list_x.append(int(input()))
max_dif=0
max_dif_indx=0
for i in range(5):
    if (10-list_x[i]%10>max_dif) & (list_x[i]%10!=0):
        max_dif=10-list_x[i]%10
        max_dif_indx=i
ans=list_x.pop(max_dif_indx)
tmp=0
for i in range(4):
    tmp+=list_x.pop()
    while(tmp%10!=0):
        tmp+=1
ans+=tmp
print(ans)

L = list(int(input()) for _ in range(5))
ans = 0
for l in L:
  if l%10 != 0:
    ans += (l-(l%10))+10
  else:
    ans += l
m = 0
for l in L:
  cnt = 0
  if (l%10) == 0:
    cnt += 1
  elif m < 10-(l%10):
    m = 10-(l%10)
if cnt == 5:
  m = 0
print(ans-m)

time = [[0]*2 for i in range(5)]
for i in range(5):
  time[i][0] = int(input())
  if time[i][0]%10 != 0:
    time[i][1] = 10*(time[i][0]//10+1) - time[i][0]

time.sort(key=lambda x: x[1])
ans = 0
for i in range(4):
  ans += time[i][0] + time[i][1]
print(ans + time[4][0])

menu=[]
menu2=[]
total=False
c=0
total2=0
for i in range(5):
    a=int(input())
    menu.append(a)
    menu2.append(a%10)
    if a%10==0:
        total2+=1
if total2==5:
    print(sum(menu))
else:
    for i in range(1,10):
        for k in range(5):
            if menu2[k]==i:
                total=True
                c=k
                break
        if total==True:
            break
    print(sum(menu)+10*(4-total2)-sum(menu2)+menu2[c])

import sys
from itertools import permutations


def answer(a: int, b: int, c: int, d: int, e: int) -> int:
    dishes = [a, b, c, d, e]
    ans = sys.maxsize

    for p in permutations(list(range(5))):
        result = 0
        for i in range(5):
            dish = dishes[p[i]]
            if i < 4:
                mod = dish % 10
                if mod != 0:
                    result += 10 - mod
            result += dish
        ans = min(ans, result)

    return ans


def main():
    a, b, c, d, e = (int(input()) for _ in range(5))
    print((answer(a, b, c, d, e)))


def __starting_point():
    main()

__starting_point()

V = [int(input()) for _ in range(5)]

v_mod = [x%10 if x%10 != 0 else 10 for x in V]
min_mod = min(v_mod)

ans = 0
for i, v in enumerate(V):
    ans += v + (10 - v_mod[i])
ans -= (10 - min_mod)
print(ans)


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

l = []
if A%10 > 0:
  l.append(A%10)
if B%10 > 0:
  l.append(B%10)
if C%10 > 0:
  l.append(C%10)
if D%10 > 0:
  l.append(D%10)
if E%10 > 0:
  l.append(E%10)
  
ans = len(l)*10 + A + B + C + D + E - sum(l)
if len(l) > 0:
  ans += min(l) - 10
print(ans)