Problem:
 Score: 200 points    Problem Statement  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 1 29
20
7
35
120      Sample Output 1 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.       Sample Input 2 101
86
119
108
57      Sample Output 2 481  If we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:   Order AGC Pasta at time 0 , which will be delivered at time 119 .  Order ARC Curry at time 120 , which will be delivered at time 206 .  Order ATC Hanbagu at time 210 , which will be delivered at time 267 .  Order APC Ramen at time 270 , which will be delivered at time 378 .  Order ABC Don at time 380 , which will be delivered at time 481 .   There is no way to order the dishes in which the last dish will be delivered earlier than this.       Sample Input 3 123
123
123
123
123      Sample Output 3 643  This is the largest valid case.

Solution (Python):
a=[int(input()) for i in range(5)]
b= [(a[i]+10-1)%10 for i in range(5)]

n=b.index(min(b))
p=a.pop(n)
c=[(a[i]+10-1)//10*10 for i in range(4)]
m=sum(c)+p
print(m)

Solution (Python):
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

def time(n):
  t = 0
  if n % 10 == 0:
    t = 0
  else:
    t = 10 - n % 10
  return t

arr = [[a, time(a)], [b, time(b)], [c, time(c)], [d, time(d)], [e, time(e)]]
arr.sort(key=lambda x: x[1], reverse=False)
arr = list(itertools.chain.from_iterable(arr))
print(sum(arr[:-1]))

Solution (Python):
A = []
B = []
for i in range(5):
    n = int(input())
    B.append(n)
    tmp = -(-n//10)*10
    A.append(tmp)

C = []
for j in range(5):
    tmp = A[j] - B[j]
    C.append(tmp)
L = max(C)

print(sum(A)-L)

Solution (Python):
a = [int(input()) for i in range(5)]
ans = 0
u = 0
o = 0
for i in range(5):
    ans += a[i]//10*10
    if a[i]%10 > 0:
        ans += 10
        if u==0:
            u=10
        u = min(u,a[i]%10)
        o = -10
print(ans+u+o)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = [a, b, c, d, e]
k = []
for i in l:
    k.append(i - ((i - 1) //10) * 10)
m = 10 - min(k)
for i in range(5):
    if l[i] % 10 != 0:
        l[i] = (l[i] // 10 + 1) * 10
print(sum(l) - m)

Solution (Python):
a = [int(input()) for i in range(5)]
ans = 10
ch = {}
b = {}
num = 0
for i in range(5):
    b[i] = a[i]
    while True:
        a[i] = a[i]%10
        if a[i] == 0:
            a[i] = 10
        if a[i] <= 10:
            ch[i] = a[i]
            break
    ans = min(ch[i],ans)
for i in range(5):
    
    if b[i] <= 99:
        if b[i] %10 == 0:
            ans -= 10
        num += b[i] - b[i]%10
        
    else:
        if b[i] %10 == 0:
            ans -= 10
        num += b[i] - (b[i] - 100)%10
print(ans + num + 40)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

t = A + B + C + D + E + (10 - a) % 10 + (10 - b) % 10 + (10 - c) % 10 + (10 - d) % 10 + (10 - e) % 10
m = max([(10 - a) % 10, (10 - b) % 10, (10 - c) % 10, (10 - d) % 10, (10 - e) % 10])
print(t - m)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = 10 * ((a + 9) // 10)
bb = 10 * ((b + 9) // 10)
cc = 10 * ((c + 9) // 10)
dd = 10 * ((d + 9) // 10)
ee = 10 * ((e + 9) // 10)
if len(set([a%10,b%10,c%10,d%10,e%10]) - {0}) > 0:
    x = min(set([a%10,b%10,c%10,d%10,e%10]) - {0})
else:
    x = 10

print(aa+bb+cc+dd+ee-(10-x))

Solution (Python):
import itertools


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

ans = []
for v in itertools.permutations(menu):
  tmp = 0
  for i in range(5):
    tmp += v[i]
    if tmp % 10 != 0 and i != 4:
      tmp += 10 - tmp % 10
  ans.append(tmp)
  

print(min(ans))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

sec_time = {}
sec_time["A"] = A, A % 10 if A % 10 != 0 else 10
sec_time["B"] = B, B % 10 if B % 10 != 0 else 10
sec_time["C"] = C, C % 10 if C % 10 != 0 else 10
sec_time["D"] = D, D % 10 if D % 10 != 0 else 10
sec_time["E"] = E, E % 10 if E % 10 != 0 else 10

sorted_sec_time = sorted(sec_time.items(), key=lambda x:x[1][1], reverse=True) 

result = 0
i = 0
for time in sorted_sec_time:
    result += time[1][0]
    i += 1
    if result % 10 != 0 and i != 5:
        result += 10 - result % 10
    
print(result)

Solution (Python):
a = [int(input()) for i in range(5)]
m=1000
for i in range(5):
    tmp = a[i]
    for j in range(5):
        if i!=j:
            if a[j]%10==0: tmp+=a[j]
            else: tmp+=(a[j]+10-a[j]%10)
    m = min(m,tmp)
print(m)

Solution (Python):
a = []
max, index, ans = 0, 0, 0
for i in range(5):
    tmp = int(input())
    a.append(tmp)
    if 10 - tmp % 10 > max and tmp % 10 != 0:
        max, index = 10 - tmp % 10, i
for i in range(5):
    if i == index or a[i] % 10 == 0:
        ans += a[i]
    else:
        ans += a[i] + 10 - a[i] % 10
print(ans)

Solution (Python):
import sys
from itertools import permutations
times = [int(sys.stdin.readline().rstrip()) for _ in range(5)]
ans = 10**10
for prm in permutations(range(5)):
    res = 0
    for i, p in enumerate(prm):
        res += times[p]
        r = times[p] % 10
        if i < 4:
            if r != 0:
                res += 10 - r
    ans = min(ans, res)
print(ans)

Solution (Python):
a = [int(input()) for i in range(5)]
m=1000
for i in range(5):
    tmp = a[i]
    for j in range(5):
        if i!=j:
            if a[j]%10==0: tmp+=a[j]
            else: tmp+=(a[j]+10-a[j]%10)
    m = min(m,tmp)
print(m)

Solution (Python):
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = sorted([a, b, c, d, e], key=lambda x: x % 10)

ans = 0
flag = False
for i in range(len(l)):
    if l[i] % 10 == 0:
        ans += l[i]
    elif flag == False:
        ans += l[i]
        flag = True
    else:
        ans += l[i]
        ans += 10 - l[i] % 10
print(ans)

'''
ans = 10**18
for v in itertools.permutations([a, b, c, d, e], 5):
    m = 0
    for i in range(len(v)):
        m += v[i]
        if i == len(v)-1:
            break
        if v[i] % 10 != 0:
            m += 10 - v[i] % 10
    ans = min(ans, m)
print(ans)

'''

Solution (Python):
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = 10**18
for v in itertools.permutations([a, b, c, d, e], 5):
    m = 0
    for i in range(len(v)):
        m += v[i]
        if i == len(v)-1:
            break
        if v[i] % 10 != 0:
            m += 10 - v[i] % 10
    ans = min(ans, m)
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10

L = []
if A != 0:
  L.append(10-A)
if B != 0:
  L.append(10-B)
if C != 0:
  L.append(10-C)
if D != 0:
  L.append(10-D)
if E != 0:
  L.append(10-E)
l = sorted(L)
s = len(l)
S = 0
for i in range(0, s-1):
  S += l[i]

total = a + b + c + d + e + S
print(total)

Solution (Python):
from math import ceil
A=[0]+[int(input()) for i in range(5)]+[0]
B=[0]+[ceil(A[i]/10)*10 for i in range(1,6)]+[0]
m=130*5
for i in range(1,6):
    m=min(m,sum(B[:i])+A[i]+sum(B[i+1:]))
print(m)

Solution (Python):



from itertools import permutations as perm


N = int(input())





B = int(input())
C = int(input())
D = int(input())
E = int(input())
m=1000000
l=[N,B,C,D,E]
for v in perm(l,5):
    t=0
    
    for i in range(5):
        t+=v[i]

        if v[i] % 10 and i!=4:
            t+=10-v[i]%10
    

    m=min(t,m)
print(m)

Solution (Python):
import math
import itertools

ceil = math.ceil

def main():
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
    l = [A, B, C, D, E]
    ans = float('inf')
    for p in itertools.permutations(l):
        anstmp = 0
        for i, f in enumerate(p):
            if i == 4:
                anstmp += f
            else:
                anstmp += ceil(f/10)*10
        ans = min(ans, anstmp)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import math
menu=5
times=[int(input()) for i in range(menu)]
times.sort()
ans = 0
for i in times:
    ans += math.ceil(i/10)*10

dif = []
for i in times:
    dif.append(math.ceil(i/10)*10 - i)

print(ans - max(dif))

Solution (Python):
ans = 0
m = 0
for _ in range(5):
    a = int(input())
    for i in range(10):
        if (a+i)%10 == 0:
            ans += a+i
            if i != 0:
                m = max(m,i)
print(ans-m)

Solution (Python):
import math

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

tlist = [A, B, C, D, E]
mod_list = [A % 10, B % 10, C % 10, D % 10, E % 10]
mod_list_2 = mod_list[:]
count = 0
already = 0

while 0 in mod_list_2:
  mod_list_2.pop(mod_list_2.index(0))
  
min_mod = 0
if mod_list_2:
  min_mod = min(mod_list_2)
  
if min_mod == 0:
  print(A + B + C + D + E)
else:
  for i in tlist:
    if (i % 10 == min_mod) and already == 0:
      already = i
    else:
      count += int(math.ceil(i / 10) * 10)
  else:
    count += already
    print(count)

Solution (Python):
import itertools
import math

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

tlist = [A, B, C, D, E]
l = itertools.permutations(tlist, 5)

t = []
count = 0

for i in l:
  count = 0
  for j in range(5):
    if j != 4 :
      count += int(math.ceil(i[j] / 10) * 10)
    else:
      count += i[j]
  t.append(count)
  
print(min(t))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def time(x):
    return (x+9)//10*10
def last(x):
    return time(x)-x
sum_tim=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_tim-max(last(a),last(b),last(c),last(d),last(e))
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
menu=[a,b,c,d,e]
time=0
for i in ["1","2","3","4","5","6","7","8","9","0"]:
    if i in [str(a)[-1],str(b)[-1],str(c)[-1],str(d)[-1],str(e)[-1]]:
        mi=[str(a)[-1],str(b)[-1],str(c)[-1],str(d)[-1],str(e)[-1]].index(i)
        break
minu=menu[mi]
for i in range(len(menu)):
    if i!=mi:
        time+=menu[i]
        while time%10!=0:
            time+=1
time+=minu
print(time)

Solution (Python):
import numpy as np
argList = np.array([int(input()) for _ in range(5)])


nokori = 10 - argList % 10
nokori[nokori==10] = 0


lastMenu = np.argmax(nokori)

jikan = 0
for i in range(5):
    
    if( i == lastMenu):
        jikan += argList[i]
    
    else:
        jikan += (argList[i] +nokori[i])
print (jikan)

Solution (Python):
m = [  int(input()) for _ in range(5) ]
m_min = sorted(m, key=lambda x: (x%10))
idx = 0
for i,x in enumerate(m_min):
    if x%10 != 0:
        idx = i
        break
order = [  i if i % 10 == 0 else (int(i/10) + 1) * 10 for i in m_min]
print(sum(order)+m_min[idx]-order[idx])

Solution (Python):
A = [0]*5
for i in range(5):
	A[i] = int(input())

mi = 10
sm = 0
min_r = 10
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10

	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	


print(sm - (10-min_r))

Solution (Python):



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

first_digit = []
for i in range(len(abcde)):
    if abcde[i] % 10 == 0:
        first_digit.append(10)
    else:
        first_digit.append(abcde[i] % 10)


ans = sum([((i-1)//10+1)*10 for i in abcde])

ans = ans-10+min(first_digit)
print(ans)

Solution (Python):
a=[0]*5
b=[10]*5
for i in range(5):
    a[i]=int(input())
    if a[i]%10!=0:
        b[i]=a[i]%10
        a[i]=int((a[i]/10)+1)*10
ans=sum(a)+min(b)-10
print(ans)

Solution (Python):
import sys

import math


from collections import deque

from fractions  import gcd

input=sys.stdin.readline
x=[int(input()) for _ in range(5)]
w=[0]*5
for i in range(5):
    if x[i]%10==0:
        j=10
    else:
        j=x[i]%10
    w[i]=10-j
w.sort()
ans=sum(x)+sum(w[:4])
print(ans)

Solution (Python):
l=[input() for _ in range(5)]
i=0
m=9
for s in l:
    s=int(s[-1])
    if s==0:
        i+=1
        continue
    m=min(m,s)
a=0
for s in l:
    a+=(int(s)+9)//10*10
print(a if i==len(l) else a-10+m)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

cost = []

min_minute = 10
for c in [A, B, C, D, E]:
    t = int(c // 10) * 10
    if c % 10 != 0:
        t += 10
        min_minute = min(c % 10, min_minute)
    cost += [t]
print(sum(cost) - 10 + min_minute)

Solution (Python):
a,b=5,10
for i in range(5):
    i=int(input())
    a+=(i-1)//10
    if 0<i%10<b:
        b=i%10
print(a*10-(10-b))

Solution (Python):
a,b=0,10
for i in range(5):
    i=int(input())
    a+=(i-1)//10+1
    if 0<i%10<b:
        b=i%10
print(a*10-(10-b))

Solution (Python):
summ = 0
check = 10
for i in range(5):
    i = int(input())
    summ += (i - 1) // 10 + 1
    if 0 < i % 10 < check:
        check = i % 10
print(summ * 10 - (10 - check))

Solution (Python):
import math
fp = 10
ans = 0
for i in range(5):
    a = int(input())
    ans+= math.ceil(a/10)*10
    if a%10!=0:
        fp =  min(fp, a%10)
print(ans+fp -10 if fp!=10 else ans )

Solution (Python):
mino=10
ans=0
for i in range(5):
  x=int(input())
  if x%10==0:
    ans+=x
  else:
    ans+=x+10-x%10
    if mino > x%10:
      mino = x%10
ans=ans-(10-mino)
print(ans)

Solution (Python):
def last_num(a):
    while a//10!=0:
        a=a%10
    return a

def marume(a):
    b=a
    while a//10!=0:
        a=a%10
    if a!=0:
        b=b-a+10
    return b

A=[int(input())for _ in range(5)]
last_order=9
order_num=0
ans=0
for i in range(5):
    if 0 < last_num(A[i]) < last_order:
        last_order=last_num(A[i])
        order_num=i
for j in range(5):
    if j !=order_num:
        ans+=marume(A[j])
    else:
        ans+=A[j]
print(ans)

Solution (Python):
from math import ceil
t = 0
maxv = 0
for i in range(5):
	n = int(input())
	t += 10 * ceil(n / 10)
	x = n % 10
	if x != 0:
		maxv = max(maxv, 10 - x)
print(t - maxv)

Solution (Python):
cook_times = sorted([int(input()) for _ in range(5)], key=lambda x: (x + 9) // 10 * 10 - x)
ans = 0
for t in cook_times[:-1]:
    ans += (t + 9) // 10 * 10
print(ans + cook_times[-1])

Solution (Python):
from itertools import permutations


cook_times = [int(input()) for _ in range(5)]
ans = float('inf')
for ts in permutations(cook_times):
    total = 0
    for t in ts[:-1]:
        if t % 10 == 0:
            total += t
        else:
            total += (t + 9) // 10 * 10
    ans = min(ans, total + ts[-1])
print(ans)

Solution (Python):
ae = [int(input()) for _ in range(5)]

sum_ae = 0
g = 9
cnt = 0  
for i in ae:
    if i % 10 != 0:
        g = min(g, i % 10)
        sum_ae += (i//10 + 1) * 10
        cnt += 1
    else:
        sum_ae += i
if cnt != 0:
    print(sum_ae - (10-g))
else:
    print(sum_ae)

Solution (Python):
from itertools import permutations


L = [int(input())for _ in range(5)]
P = []
for _ in range(5):
    P.append(_)

ans = float('inf')
for p in permutations(P):
    now = 0
    for i, a in enumerate(p):
        if i == 4:
            now += L[a]
        else:
            now += ((L[a]-1)//10)*10 + 10

    ans = min(ans, now)

print(ans)

Solution (Python):
ans = 0
arr = [int(input()) for _ in range(5)]
ans = float('inf')
maxsum = 0
for i in range(5):
    maxsum += -(-arr[i] // 10) * 10
for i in range(5):
    if maxsum - -(-arr[i] // 10) * 10 + arr[i] < ans:
        ans = maxsum - -(-arr[i] // 10) * 10 + arr[i]
print(ans)

Solution (Python):
import math
a = input()
b = input()
c = input()
d = input()
e = input()
l = []
if a[-1] != '0': l.append(a[-1])
if b[-1] != '0': l.append(b[-1])
if c[-1] != '0': l.append(c[-1])
if d[-1] != '0': l.append(d[-1])
if e[-1] != '0': l.append(e[-1])
if l == []:
  print(int(a)+int(b)+int(c)+int(d)+int(e))
else:
  min_l = min(l)
  p = [ a,b,c,d,e ]
  o = []
  len_p = len(p)
  tmp_p = ''
  for i in range(0, len_p):
    if p[i][-1] == min_l:
      tmp_p = int(p.pop(i))
      break
  new_p = 0
  for i in p:
    new_p += math.ceil(int(i)/10)*10
  print(new_p+tmp_p)

Solution (Python):
def resolve():
    import itertools
    AE = [int(input()) for _ in range(5)]
    minA = float("inf")
    for ae in itertools.permutations(AE):
        sumA = 0
        for dish in ae:
            if sumA % 10 != 0:
                sumA += 10 - (sumA % 10)
            sumA += dish
        minA = min(minA, sumA)
    print(minA)


resolve()

Solution (Python):
a=[int(input()) for i in range(5)]
result=0
ans=0
x=10
for i in a:
    if i%10!=0:
        result+=(i//10+1)*10
    else:
        result+=i
for i in a:
    if i%10!=0:
        ans=i%10
        if ans<x:
            x=ans
print(result+x-10)

Solution (Python):
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[math.ceil(i/10)*10 for i in l]
temp=[]
for i,j in zip(li,l):
  temp.append(i-j)

print(sum(li)-max(temp))

Solution (Python):
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
lil = [i for i in li if i!=0]
if lil:
  minimum=min([i for i in li if i!=0])
else:
  minimum=0
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)

Solution (Python):
import math
a=[int(input()) for i in range(5)]
aa=[int(math.ceil(i/10)*10) for i in a]
b=0
c=10**5

for i in range(5):
	b=sum(aa)-aa[i]+a[i]
	if b<c:
		c=b
print(c)

Solution (Python):
import math

a = [float(input()) for _ in range(5)]
a_ceil = [math.ceil(0.1*a[n])*10 for n in range(len(a))]
a_p10 = [a[n] % 10 for n in range(len(a))]

for i in range(len(a)):
    if a_p10[i] == 0:
        a_p10[i] += 10
last = a_p10.index(min(a_p10))
total = int(sum(a_ceil) - a_ceil[last] + a[last])
print(total)

Solution (Python):
import numpy as np

a = list(int(input()) for i in range(5))
b = np.array(a)
c = np.ceil(b/10)*10
d = max(c-b)

print(int(sum(c)-d))

Solution (Python):
from itertools import permutations
x = (int(input()) for _ in range(5))
ans = 650
for p in permutations(x, 5):
  tmp = 0
  for i, v in enumerate(p):
    if i != len(p) - 1:
      tmp += (v // 10 + 1) * 10 if v % 10 else v
    else:
      tmp += v
  ans = min(ans, tmp)
  
print(ans)

Solution (Python):
li,lia = [],[]
total = 0
for i in range(5):
    a = input()
    li.append(a)
for i in range(5):
    lia.append(li[i][-1])
lib = [int(s) for s in lia]
b = lib.count(0)
for i in range(b):
    lib.remove(0)
for i in range(5):
    total += (int(li[i])//10+1)*10
if len(lib) >= 1:
    total -= 10*(1+b)
else:
    total -= 10*(b)
if len(lib) >= 1:
    total += min(lib)
if total <= 0:
    print(0)
else:
    print(total)

Solution (Python):
import math
a=[[0,0] for i in range(5)]
for i in range(5):
    a[i][0]=int(input())
    a[i][1]=abs(10*math.ceil(a[i][0]/10)-a[i][0])
a2=sorted(a,key=lambda x:x[1])
ans=0
for i in range(4):
    ans+=10*math.ceil(a2[i][0]/10)
ans+=a2[4][0]
print(ans)

Solution (Python):
N = [int(input()) for _ in range(5)]
A = []
B = []
C = []
for n in N:
    n = list(str(n))
    n.reverse()
    A.append(int(n[0]))
for a in A:
  if a == 0:
    B.append(100)
  else:
    B.append(a)
    C.append(10-a)
b = min(B)
if b == 100:
  b = 10
print(sum(N)+sum(C)-(10-b))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

a1,b1,c1,d1,e1 = a%10, b%10, c%10, d%10, e%10

ans = 0

total = a+b+c+d+e

a1 = 10 - a1
b1 = 10 - b1
c1 = 10 - c1
d1 = 10 - d1
e1 = 10 - e1

if a1 == 10:
    a1 = 0
if b1 == 10:
    b1 = 0
if c1 == 10:
    c1 = 0
if d1 == 10:
    d1 = 0
if e1 == 10:
    e1 = 0

wait = a1+b1+c1+d1+e1 - max(a1,b1,c1,d1,e1)

ans = total + wait
print(ans)

Solution (Python):
tl=[int(input()) for i in range(5)]

import itertools

ansl=[]

for tup in itertools.permutations(tl):
    t=list(tup)
    c=0
    for i in range(4):
        c+=t[i]
        if c%10!=0:
            c=(c//10 +1)*10
    ansl.append(c+t[-1])

print(min(ansl))

Solution (Python):
l=sorted(list(map(int,open(0))),key=lambda x:-x%10)
print(sum([i+(-i%10) for i in l[:4]])+l[4])

Solution (Python):
tt = [int(input()) for i in range(5)]
ll = [10*i for i in range(14)]
ans = []
at = bt = ct = dt = et = 0
for t in tt:
    i = 0
    while t > ll[i]:
        i+=1
    ans.append(ll[i])

max = 0
dex = 0
for i in range(5):
    if ans[i] - tt[i] > max:
        dex = i
        max = ans[i]-tt[i]
at = 0
for j in range(5):
    if j != dex:
        at += ans[j]
    if j == dex:
        at += tt[j]

print(at)

Solution (Python):
import math
from itertools import permutations

l=[int(input()) for i in range(5)]
result=sum(math.ceil(l[i]/10)*10 for i in range(5))
orders=list(permutations(l,5))

for order in orders:
  tmp=order[0]
  for i in range(1,5):
    tmp+=math.ceil(order[i]/10)*10
  result=min(result,tmp)

print(result)

Solution (Python):
a = [0]*5
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
b = 10**10
t = 0
for i in range(5):
    c = a[i]%10
    t += -1*(-1*a[i]//10)*10
    if c == 0:
        pass
    else:
        b = min(b,c)
if b == 10**10:
    print(t)
else:
    print(t+b-10)

Solution (Python):
A = [int(input()) for i in range(5)]

ans = 0
remain = 10
for a in A:
  if a%10 == 0:
    ans += a//10
    
  else:
    ans += (a+10)//10
    
    remain = min(remain, a%10)
    
print(ans * 10 + remain -10)

Solution (Python):
A=int(input())
ans=0

for i in range(4):
    B=int(input())
    if A%10>B%10>0: A,B=B,A
    ans+=-(-B//10)*10

print(A+ans)

Solution (Python):
A=int(input())
lis=[]

for i in range(4):
    B=int(input())
    if A%10>B%10>0:
        lis.append(-(-A//10)*10)
        A=B
    else:
        lis.append(-(-B//10)*10)

print(A+sum(lis))

Solution (Python):
import math

time = [0]*5
time_ = [0]*5
for i in range(5):
  time[i] = int(input())
  time_[i] = (time[i]-1)%10

ans = 0
tmin = min(time_)
flag = True
for i in range(5):
  if (time[i]-1)%10==tmin and flag:
    ans += time[i]
    flag = False
  else:
    ans += math.ceil(time[i]*0.1)*10
print(int(ans))

Solution (Python):
import math
l=[int(input()) for i in range(5)]
t=[]
for ll in l:
  t.append(math.ceil(ll/10))
lis=[]
for i in range(5):
  lis.append(t[i]*10-l[i])
m=max(lis)
sum=0
for i in range(5):
  sum+=t[i]*10
print(sum-m)

Solution (Python):
from decimal import Decimal, ROUND_UP


cook_time = []
append = cook_time.append

for i in range(5):
    append(int(input()))


cook_time.sort(key=lambda x: int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) - x)
res = 0
for c in cook_time:

    if res % 10 != 0:
        res = int(Decimal(res).quantize(Decimal("1E1"), rounding=ROUND_UP))

    res += c

print(res)

Solution (Python):

def inp():
    return(int(input()))



def inlist():
    return(list(map(int, input().split())))



def instr():
    s = input()
    return(list(s[:len(s)]))



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


D = []

for i in range(5):
    D.append(inp())

D = sorted(D, key=lambda d: 0 if d % 10 == 0 else ((d//10)+1)*10-d)

res = 0
for d in D[:4]:
    if d % 10 != 0:
        res += d + (((d//10)+1)*10-d)
    else:
        res += d
print(res+D[4])

Solution (Python):
li = []
li.append(int(input()))
li.append(int(input()))
li.append(int(input()))
li.append(int(input()))
li.append(int(input()))

for i in range(len(li)-1):
    if li[i] % 10 < li[i+1] % 10 or li[i+1] % 10 == 0:
        x = li[i]
        li[i] = li[i+1]
        li[i+1] = x
for i in range(len(li)):
    if i == len(li)-1:
        break
    d10 = li.pop(i)
    if d10 % 10 != 0:
        li.insert(i, (d10//10+1) * 10)
    else:
        li.insert(i, (d10//10+0) * 10)
print(sum(li))

Solution (Python):
import math
m = [int(input()) for i in range(5)]
n = 10
ans = 0
for i in m:
    ans+= math.ceil(i/10)*10
    if i%10!=0:
        n = min(n, i%10)
print(ans-10+n)

Solution (Python):
import itertools
import math

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

for i in itertools.permutations(l, 5):
    time = 0
    for j in range(5):
        time += i[j]
        if j != 4:
            time = math.ceil(time / 10) * 10
    ans = (min(ans, time))

print(ans)

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue



ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return math.ceil(N/10)*10


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    R = [ii() for _ in range(5)]

    ret = MAX
    for r in itertools.permutations(R, 5):
        tmp = 0
        for i in range(len(r)):
            if i == 4:
                tmp += r[i]
            else:
                tmp += f(r[i])
        ret = min(tmp, ret)

    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    K = [int(input()) for _ in range(5)]
    ans = []
    A = [0]
    for k in K:
        a = k % 10
        if a == 0:
            ans.append(k)
        else:
            ans.append(k + (10 - a))
            A.append(10 - a)
    print(sum(ans) - max(A))


if __name__ == "__main__":
    main()

Solution (Python):
import itertools
t = []
for _ in range(5):
    t.append(int(input()))

most_fast = 10**5

for i in itertools.permutations(t,5):
    time = 0
    for j in range(4):
        time += i[j]
        if time % 10 != 0:
            time += 10 - (time % 10)
    time += i[4]
    if time <= most_fast:
        most_fast = time

print(most_fast)

Solution (Python):
A = [int(input()) for _ in range(5)]

def solve():
    min_mod = min(map(lambda x:(x-1)%10+1,A))
    ceil_A = sum(map(lambda x:(x+9)//10*10,A))
    ans = ceil_A - 10 + min_mod
    return ans
print(solve())

Solution (Python):
L = [int(input()) for _ in range(5)]
S = [10*(L[j]//10) if L[j]%10==0 else 10*((L[j]//10)+1) for j in range(5)]
M = [S[i]-L[i] for i in range(5)]
print(sum(S)-(max(M)))

Solution (Python):
import math
A =[]
for i in range(5):
    A.append(int(input()))

m = 11
index = 0
for i,a in enumerate(A):
   if a%10!=0 and m > a%10:
       index = i
       m = a % 10

temp = A[index]
del A[index]

A = list(map(lambda x:math.ceil(x/10)*10,A))

print(sum(A)+temp)

Solution (Python):
import math
A = [int(input()) for i in range(5)]
B = [math.ceil(A[i]/10)*10 for i in range(5)]
C = [B[i]-A[i] for i in range(5)]
big = C.index(max(C))
ans = sum(B)-B[big]+A[big]
print(ans)

Solution (Python):
l=list()
L=list()
for i in range(5):
  n=int(input())
  if n%10==0:
    l.append(n)
  else:
    L.append(n)
if len(l)==5:
  print(sum(l))
  exit()
    
LL=list()
for n in L:
  N=n%10
  LL.append(N)
key=min(LL)
LL.remove(key)

x=len(LL)*10

M=list()
for n in L:
  nn=n//10*10
  M.append(nn)
  
  
print(sum(l)+sum(M)+x+key)

Solution (Python):
import math
from itertools import permutations
menu = 5
times = [int(input()) for _ in  range(menu)]
orders = list(permutations(times, menu))
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(total, minimum)
print(minimum)

Solution (Python):

A = [int(input()) for i in range(5)]
B = [10 if i % 10 == 0 else i % 10 for i in A]
minB = A.pop(B.index(min(B)))
A = [i if i % 10 == 0 else i + 10 - (i % 10) for i in A]
A.append(minB)
print(sum(A))

Solution (Python):
ans = 0
s = 9
flag = True
for i in range(5):
    n = int(input())
    if n%10 != 0:
        s = min(s,n%10)
        ans += n//10+1
        flag = False
    else:
        ans += n//10
else:
    if flag:
        print(ans*10)
    else:
        print((ans-1)*10+s)

Solution (Python):
ans = 0
s = 100
for i in range(5):
    a = int(input())
    r = a % 10
    if r > 0:
        s = min(s, r)
    ans += a // 10 * 10 + (10 if r > 0 else 0)
if s == 100:
    print(ans)
else:
    print(ans + s - 10)

Solution (Python):
import itertools
import math
import fractions
import functools
import copy

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
original = [a,b,c,d,e]

sum = 0
minimum = 10
index = 0
for i in range(len(original)):
    if original[i] % 10 != 0:
        sum += original[i]//10 * 10 + 10
        if original[i]%10 < minimum:
            index = i
            minimum = original[i]%10
    else:
        sum += original[i]
if minimum != 10:
    print(sum-(original[index]//10 * 10 + 10)+original[index])
else: print(a+b+c+d+e)

Solution (Python):
A = [int(input()) for i in range(5)]
count=0 
max_i=0
for i in A:
    if i%10!=0:
        max_i = max(max_i,10-i%10)
        count += i//10*10+10
    else:
        count += i
print(count-max_i)

Solution (Python):
A = []
for i in range(5):
  a = int(input())
  A.append(a)
B = []
for i in range(5):
  b = A[i]%10
  B.append(b)
C =[]
for i in range(5):
  if B[i] != 0:
    c = A[i]+10-B[i]
  else:
    c = A[i]
  C.append(c)
t = 0  
for i in range(5):
  t += C[i]
B.sort()
z = set(B)
if min(z) == 0:
  z.remove(0)
if len(z) ==0:
  print(t)
else:
  print(t-10+min(z))

Solution (Python):
A = []
for i in range(5):
  a = int(input())
  A.append(a)
B = []
for i in range(5):
  b = A[i]%10
  B.append(b)
C =[]
for i in range(5):
  if B[i] != 0:
    c = A[i]+10-B[i]
  else:
    c = A[i]
  C.append(c)
t = 0  
for i in range(5):
  t += C[i]
B.sort()
z = set(B)
if min(z) == 0:
  z.remove(0)
if len(z) ==0:
  print(t)
else:
  print(t-10+min(z))