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):


import math
def main():
    times = [input() for i in range(5)]

    
    mini_one = 10
    mini_one_index = 0
    for i, time in enumerate(times):
        one = int(time[len(time)-1])
        if mini_one > one and one > 0:
            mini_one = one
            mini_one_index = i

    all_time = 0
    for i, time in enumerate(times):
        if i == mini_one_index:
            all_time += int(time)
        else:
            one = int(time[len(time)-1])
            if one == 0:
                all_time += int(time)
            else:
                ten_time = (math.floor(int(time) / 10)+1) * 10
                all_time += ten_time

    print(all_time)



if __name__ == "__main__":
    main()

Solution (Python):
inp = []
tmp = 10
ans = 0
temp = 0
for _ in range(5):
    inp.append(input())
for i in range(5):
    if tmp > int(inp[i][-1]) and int(inp[i][-1]) != 0:
        tmp = int(inp[i][-1])
        temp = i
last = inp.pop(temp)
for j in inp:
    if j[-1] == "0":
        ans += int(j)
    else:
        ans += int(j[:-1]+ "0") + 10
ans += int(last)
print(ans)

Solution (Python):
l = [int(input()) for i in range(5)]
min = 9
min_index = 0
sum = 0
for i in range(len(l)):
    if l[i] % 10 != 0 and l[i] % 10 < min:
        min = l[i] % 10
        min_index = i
for i in range(len(l)):
    if i != min_index:
        sum += (l[i] + 9) // 10 * 10
sum += l[min_index]
print(sum)

Solution (Python):
line = []
for i in range(5):
    line.append(int(input()))
line10 = list(map(lambda x: x % 10, line))
pittari = []
for i in range(5):
    if line10[i] == 0:
        pittari.append(i)
if len(pittari) == 5:
    print(sum(line))
else:
    imy = []
    for i in range(5):
        if not(i in pittari):
            imy.append(i)
    imylist = []
    for i in imy:
        imylist.append(line10[i])
    last = line10.index(min(imylist))
    sum = 0
    for i in range(5):
        if i != last and not(i in pittari):
            line[i] = line[i] - line10[i] + 10
            sum += line[i]
    for i in pittari:
        sum += line[i]
    print(line[last] +  sum)

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

LL = {}

for i in range(len(L)):
	I = str((L[i]-1))[-1]
	I = int(I)
	LL[i] = I

key = [k for k,v in LL.items() if v == min(LL.values())][0]

min = L[key]
L[key] = 0

for i in range(0,5):
	digit_one = str(L[i])[-1]
	if digit_one != "0":
		L[i] += 10 - int(digit_one)
	
print(sum(L) + min)

Solution (Python):
import math

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

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

time = math.ceil(A/10) * 10 + math.ceil(B/10) * 10 + math.ceil(C/10) * 10 + math.ceil(D/10) * 10 + math.ceil(E/10) * 10 - max(a,b,c,d,e)
print(time)

Solution (Python):
a = [int(input()) for _ in range(5)]
ans,mgn = 0,0
for i in range(5):
    if(a[i]%10 == 0):
        ans += a[i]
    else:
        ans += int(a[i]//10+1)*10
        mgn = max(mgn, 10-(a[i]%10))
print(ans-mgn)

Solution (Python):
import math
cnt=0
fir=10
for i in range(5):
	a=int(input())
	b=(math.ceil(a/10))*10
	cnt += b
	if int(str(a)[-1]) != 0 and fir > int(str(a)[-1]):
		fir = int(str(a)[-1])
print(cnt+(fir-10) if fir != 0 else cnt)

Solution (Python):
a,b,c,d,e = [int(input()) for i in range(5)]
x = [a,b,c,d,e]
y = [0]*5
for i in range(5):
    if x[i]%10==0:
        y[i]=0
    else:
        y[i]=10-x[i]%10
print(a+b+c+d+e+sum(y)-max(y))

Solution (Python):
inp = []
tmp = 10
ans = 0
temp = 0
for _ in range(5):
    inp.append(input())
for i in range(5):
    if tmp > int(inp[i][-1]) and int(inp[i][-1]) != 0:
        tmp = int(inp[i][-1])
        temp = i
last = inp.pop(temp)
for j in inp:
    if j[-1] == "0":
        ans += int(j)
    else:
        ans += int(j[:-1]+ "0") + 10
ans += int(last)
print(ans)

Solution (Python):
A = [int(input()) for _ in range(5)]
B = [-(-a//10)*10-a for a in A]

print(sum(A)+sum(B)-max(B))

Solution (Python):
import math
ls = [int(input()) for _ in range(5)]
ans = 0
num = []

for i in ls:
    ans += math.ceil(i/10)*10
    if str(i)[-1] != '0':
        num.append(str(i)[-1])

if num:
    print(ans-10+min([int(i) for i in num]))
else:
    print(ans)

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

cnt = 10
m = 0
for i in range(5):
    if dish[i] % 10 != 0 and dish[i] % 10 < cnt:
        cnt = dish[i] % 10
        m = i

ans = dish.pop(m)
for d in dish:
    if d % 10 == 0:
        ans += d
    else:
        ans += 10 * (d//10+1)

print(ans)

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


aa=a%10
bb=b%10
cc=c%10
dd=d%10
ee=e%10

temp=min(aa,bb,cc,dd,ee)

if aa!=0:
	aaa=(a//10)*10+10
else:
	aaa=a

if bb!=0:
	bbb=(b//10)*10+10
else:
	bbb=b
	
if cc!=0:
	ccc=(c//10)*10+10
else:
	ccc=c
	
if dd!=0:
	ddd=(d//10)*10+10
else:
	ddd=d
	
if ee!=0:
	eee=(e//10)*10+10
else:
	eee=e
	
a1=a+bbb+ccc+ddd+eee
a2=aaa+b+ccc+ddd+eee
a3=aaa+bbb+c+ddd+eee
a4=aaa+bbb+ccc+d+eee
a5=aaa+bbb+ccc+ddd+e

ans=min(a1,a2,a3,a4,a5)

print(ans)

Solution (Python):
import math
l = [int(input())for _ in range(5)]
lm = []
for i in l:
    if i%10==0:
        lm.append(0)
    else:
        lm.append(10-i%10)
print(sum([10*math.ceil(i/10)for i in l])-max(lm))

Solution (Python):
import math
m1=[int(input()) for _ in range(5)]
m2=[math.ceil(x/10)*10 for x in m1]
slack=max([x-y for x,y in zip(m2,m1)])
print(sum(m2)-slack)

Solution (Python):
D = [int(input()) for _ in range(5)]
d = [(10-i%10)%10 for i in D]
s = 0
for i in range(5):
    s += D[i]+d[i]
print(s-max(d))

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

x_1 = [int(i / 10) for i in x]
x_2 = [(i % 10) for i in x]

ans = sum(x_1)*10 

for i in range(x_2.count(0)):
    x_2.remove(0)

if(x_2 != []):
    ans += min(x_2)
    ans += (len(x_2)-1)*10

print(ans)

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

L = [A, B, C, D, E]
M = [l // 10 * 10 if l % 10 == 0 else (l // 10 + 1) * 10 for l in L]
N = [l % 10 for l in L]
N = [n if n != 0 else 10 for n in N]

zipped = zip(L, M, N)
zipped = sorted(zipped, key=lambda x: [x[2]], reverse=False)
L, M, N   = map(list, zip(*zipped))

print(L[0] + sum(M[1:]))

Solution (Python):
import math
S = [int(input()) for _ in range(5)]
ans=0
mini=10
for i in S:
    ans+=math.ceil(i/10)*10
    b = i % 10
    if b== 0:
      b=10
    mini=min(b,mini)

if mini == 10:
  print(ans)
else:
  print(ans-(10-mini))

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



menu_time = 0
apart_time = 0
total_time = 0
max_apart_time = 0
for i in range(5):
    menu_time = list[i]
    apart_time =  0 if menu_time % 10 == 0 else \
        (menu_time // 10 + 1) * 10 - menu_time
    total_time += menu_time + apart_time
    if apart_time > max_apart_time:
        max_apart_time = apart_time

total_time -= max_apart_time

print(total_time)

Solution (Python):
x = [input() for _ in range(5)]
ans = []
for i in range(5):
    if x[i][-1] == "0":
        ans.append(int(x[i]))
for j in range(9,0,-1):
    for i in range(5):
        if int(x[i][-1]) == j:
            if len(ans) != 4:
                for k in range(1,10):
                    if (int(x[i]) + k )% 10 == 0:
                        ans.append(int(x[i]) + k)
            else:
                ans.append(int(x[i]))

print(sum(ans))

Solution (Python):
from math import ceil

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

min_a = max(a)
index_min = 4
for i in range(5):
    if a[i] % 10 == 0:
        continue
    elif min_a > a[i] % 10:
        min_a = a[i] % 10
        index_min = i

ans = 0
for i in range(5):
    if i == index_min:
        continue
    ans += ceil(a[i]/10) * 10

ans += a[index_min]
print(ans)

Solution (Python):
import itertools

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

def round_up_10(x):
    if x%10 == 0:
        return x
    else:
        return x - (x%10) + 10


ans = float("inf")
order = list(itertools.permutations(ABCDE))

for o in order:
    current_time = 0
    for i in range(5):
        current_time += o[i]
        if i == 4:
            break
        current_time = round_up_10(current_time)
    ans = min(ans, current_time)
    
print(ans)

Solution (Python):
T=[]
for _ in range(5):
    T.append(int(input()))
ans=sum([(t//10)*10 for t in T])
U=[t%10 for t in T]
U.sort()
if U[4]==0:
    pass
elif U[3]==0:
    ans+=U[4]
elif U[2]==0:
    ans+=10+U[3]
elif U[1]==0:
    ans+=20+U[2]
elif U[0]==0:
    ans+=30+U[1]
else:
    ans+=40+U[0]
print(ans)

Solution (Python):
from math import ceil
A= [int(input()) for _ in range(5)]
rA = list(map(lambda x:x%10, A))
res = float('inf')
idx = 0
for i, r in enumerate(rA):
    if res>r>0:
        idx = i
        res = r
ans = A.pop(idx)
tA = [ceil(A[i]/10)*10 for i in range(len(A))]
print(sum(tA)+ans)

Solution (Python):

import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
lastOrder = min((A-0.5)%10,(B-0.5)%10,(C-0.5)%10,(D-0.5)%10,(E-0.5)%10)
print(math.ceil(A/10)*10 + math.ceil(B/10)*10 + math.ceil(C/10)*10 + math.ceil(D/10)*10 + math.ceil(E/10)*10 - 10 + int(lastOrder) + 1)

Solution (Python):
L = [int(input()) for _ in range(5)]
t = 0
L2 = []
for i in range(5):
  if L[i]%10 == 0:
    t += L[i]
  else:
    L2.append(L[i])
if L2 == []:
  print(t)
  exit()
min = L2[0]
for k in range(1,len(L2)):
  if min%10 > L2[k]%10:
    t += min//10*10 + 10
    min = L2[k]
  else:
    t += L2[k]//10*10 + 10
print(t+min)

Solution (Python):

time = list(map(int, open(0).read().split()))


time_residual = [i%10 for i in time]


time_residual_notZero = [i for i in time_residual if i%10 != 0 ]


if(time_residual_notZero != []):
    ans = sum([-(-i//10)*10 for i in time]) + min(time_residual_notZero) - 10
else:
    ans = sum(time)
print(ans)

Solution (Python):
A=[int(input()) for _ in [0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Solution (Python):
import sys
lst=[]
ans=0
for i in range(5):
  a=int(input())
  if a%10==0:
    ans+=a
  else:
    lst.append(a)
if len(lst)!=0:
  C=[[] for _ in range(len(lst))]   
  for i in range(len(lst)):
    v=lst[i]
    c=v%10
    C[i]=[-c,v]
  C=sorted(C)
  for i in range(len(lst)-1):
    v=C[i][1]
    c=-C[i][0]
    ans+=(v+(10-c))
  print(ans+C[-1][1])
else:
  print(ans)

Solution (Python):
lis = [int(input()) for _ in range(5)]
lis1 = [lis[i]%10 for i in range(5)]
lis10 = [lis[i]//10 for i in range(5)]
ans = 0
for i in range(5):
    if lis1[i]:
        ans += 10
    if not lis1[i]:
        lis1[i] = 10
minlis1 = min(lis1)
ans += sum(lis10)*10
ans += minlis1-10

print(ans)

Solution (Python):
A = [int(input()) for _ in [0]*5]
B = [-(-a//10)*10 - a for a in A]
print(sum(B) + sum(A) - max(B))

Solution (Python):
time = []
total = 0
for _ in range(5):
    t = int(input())
    if t % 10 == 0:
        total += t
    else:
        total += (t//10+1)*10
        time.append(t)
if time:
    last = min(time, key=lambda x: int(str(x)[-1]))
    print(total - 10+last%10)
else:
    print(total)

Solution (Python):
dishes = []
zero = []

for i in range(5):
    x = int(input())
    if int(str(x)[-1]) != 0:
        dishes.append(x)

    else:
        zero.append(x)

dishes = sorted(dishes, key=lambda x: str(x)[-1])
dishes.reverse()

dishes = zero + dishes

ans = 0
for i in range(len(dishes)):
    if i == len(dishes)-1:
        ans += dishes[i]
    else:
        sa = 10 - int(str(dishes[i])[-1])
        if sa == 10:
            ans += dishes[i]
        else:
            ans += dishes[i] + sa

print(ans)

Solution (Python):
menu = [int(input()) for _ in range(5)]
x = sorted(list(map(lambda x: 10 - x % 10, [i for i in menu if i % 10 != 0])))
tot = sum(menu) + sum(x[:-1])
print(tot)

Solution (Python):
a = [int(input()) for _ in range(5)]
b = [(i//10 + 1) * 10 if i % 10 != 0 else i for i in a]
c = [j-i for i, j in zip(a,b)]
print(sum(b)-max(c))

Solution (Python):
times = [int(input()), int(input()), int(input()), int(input()), int(input())]
mods = [10-time%10 if time%10 != 0 else 0 for time in times]
print(sum(times) + sum(mods) - max(mods))

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

ac = math.ceil(a / 10) * 10
bc = math.ceil(b / 10) * 10
cc = math.ceil(c / 10) * 10
dc = math.ceil(d / 10) * 10
ec = math.ceil(e / 10) * 10

max_diff = max((ac - a, bc - b, cc - c, dc - d, ec - e))
print(ac + bc + cc + dc + ec - max_diff)

Solution (Python):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *

from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    times = []
    ans = 0
    for _ in range(5):
        time = int(input())
        if time % 10 == 0:
            ans += time
        else:
            times.append(time)
    if len(times)==0:
        print(ans)
        return 0

    times.sort(key=lambda x: x%10,reverse=True)
    ans += times[-1]
    times = times[:-1]
    if len(times)==0:
        print(ans)
        return 0

    for time in times:
        ans += 10*(time//10+1)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math
L = [int(input()) for _ in range(5)]
Lm = []
for i in L:
    if i%10 == 0:
        Lm.append(0)
    else:
        Lm.append(10-i%10)
print(sum([10*math.ceil(i/10) for i in L])-max(Lm))

Solution (Python):
ls=[0,0,0,0,0]
for i in range(5):
  ls[i]=int(input())
ls2=sorted(ls, key=lambda x: (x-1)%10)
ls3=[((e-1)//10+1)*10 for e in ls2]
print(ls2[0]+ls3[1]+ls3[2]+ls3[3]+ls3[4])

Solution (Python):
n=[int(input()) for i in range(5)]
s=[0,0,0,0,0]
for i in range(5):
    if n[i]%10==0:
        s[i]=0
    else:
        s[i]=10-n[i]%10

a=s.index(max(s))

b=0
for i in range(5):
    if i!=a:
        b+=n[i]+s[i]
    else:
        b+=n[i]
print(b)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = [A, B, C, D, E]
a.sort(key=lambda x: (x+9) % 10, reverse=True)
print(sum((i + 9) // 10 * 10 for i in a[:4]) + a[4])

Solution (Python):
a_list = []
temp_min = 10
temp_sum = 0
[a_list.append(int(input())) for i in range(5)]
for i in a_list:
    if i%10 != 0:
        temp_min = min(i%10,temp_min)
        temp_sum += 10 - i%10
print(sum(a_list)+temp_sum - 10 + temp_min)

Solution (Python):
n = [input() for i in range(5)]
flag = 1
ans = 0
l = []
while flag:
    flag = 0
    for i in range(len(n)-1,0,-1):
        if n[i][-1] < n[i-1][-1]:
            n[i],n[i-1] = n[i-1],n[i]
            flag = 1
for i in range(len(n)):
    if n[i][-1] != '0':
        n[i] = int(n[i])
        l = n.pop(i)
        break
for i in range(len(n)):
    n[i] = int(n[i])
for i in range(len(n)):
    while n[i]%10 != 0:
        n[i] += 1
    ans += n[i]
if l:
    ans += l
print(ans)

Solution (Python):
n = [int(input()) for _ in range(5)]
first_digit = []
for num in n:
    z = int(str(num)[-1])
    if z > 0:
        first_digit.append(z)



t = 0
for i in range(len(n)):
    t += -(-n[i] // 10) * 10
if len(first_digit) == 0:
    print(t)
else:
    print(t - (10 - min(first_digit)))

Solution (Python):
l = list(map(int, open(0).read().split()))
print(sum([(x+9)//10 for x in l])*10-9+min([(x-1)%10 for x in l]))

Solution (Python):
m=[int(input()) for i in range(5)]
k = []
j=[]
for i in range(5):
    j.append(-(-m[i]//10)*10)
    
    
    t=m[i] - (m[i]//10)*10
    if t>0:
        k.append(t)
if len(k)==0:
    print(sum(j))
else:
    print(sum(j)-(10-min(k)))

Solution (Python):
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Solution (Python):
def f_b():
    from math import ceil
    *a, = map(int, open(0).read().split())
    a.sort(key=lambda x: (10-x%10)%10)
    print(sum(map(lambda x: ceil(x/10)*10, a[:-1]))+a[-1])

if __name__ == "__main__":
    f_b()

Solution (Python):


n = 5
s = []
lastS = []
for i in range(n):
    s.append(raw_input())
    lastS.append(int(s[i][-1]))


min = 9
minMenu = 0
for i in range(n):
    if lastS[i] < min and lastS[i] != 0:
        minMenu = i
        min = lastS[i]


ans = 0
for i in range(n):
    if i != minMenu:
        if lastS[i] != 0:
            ans += (int(s[i]) - lastS[i]) + 10
        else:
            ans += int(s[i])
    else:
        ans += int(s[i])

print ans

Solution (Python):
T=[]
t=[]
for i in range(5):
    T.append(int(input()))
    t.append(T[i]%10)
if max(t) == 0 :
    ans = sum(T)
else :
    while 0 in t  :
        t.remove(0)
    ans = sum(T)+10*len(t)-sum(t)-10+min(t)
print(ans)

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

Solution (Python):
import math

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

sa = a % 10
if sa == 0:
    sa = 10
sb = b % 10
if sb == 0:
    sb = 10
sc = c % 10
if sc == 0:
    sc = 10
sd = d % 10
if sd == 0:
    sd = 10
se = e % 10
if se == 0:
    se = 10


amari = min(sa,sb,sc,sd,se)


a = math.ceil(a / 10) *10
b = math.ceil(b / 10) *10
c = math.ceil(c / 10) *10
d = math.ceil(d / 10) *10
e = math.ceil(e / 10) *10


if amari == 0:
    print(int(a+b+c+d+e))
else:
    print(int(a+b+c+d+e-10+amari))

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

Solution (Python):
import math

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

min1 = map(lambda x: x % 10, t)
min1 = min([10 if i == 0 else i for i in min1])

print(sum(map(lambda x: math.ceil(x) * 10, [i/10 for i in t])) - (10 - min1))

Solution (Python):
a = list(int(input()) for _ in range(5))
s = sum(a)

b = [i for i in a if i % 10 != 0]

if b:
    a_ = list(10-(j % 10) for j in b)
    a_.sort()
    a_.pop(-1)
    print(s + sum(a_))
else:
    print(s)

Solution (Python):
s=[int(input()) for i in range(5)]
list=[]
a=0
b=0
for j in range(5):
  if s[j]%10!=0:
    list.append(s[j]%10)
    a+=1
if 0<a:
  list.sort()
  for k in range(5):
    if s[k]%10==0:
      b+=s[k]
    else:
      c=s[k]%10
      b+=s[k]+10-c
  b=b-10+list[0]
  print(b)
else:
  for l in range(5):
    b+=s[l]
  print(b)

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

Solution (Python):
import math
src = [input() for _ in range(5)]
k_li = []
v_li = []
sum = 0
for s in src:
    if int(s[-1]) != 0:
        k_li.append(int(s[-1]))
        v_li.append(int(s))
    else:
        sum += int(s)
flag = False
if len(k_li)>0:
    m = min(k_li)
    for k,v in zip(k_li,v_li):
        if k == m and flag == False:
            sum += v
            flag = True
        else:
            sum += math.ceil(v/10)*10
print(sum)

Solution (Python):
L = [int(input()) for i in range(5)]
a =[0]*5
ans = sum(L)
for i in range(5):
    if L[i]%10>0:
        a.append(10-L[i]%10)

print(sum(L)+sum(a)-max(a))

Solution (Python):
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """29
20
7
35
120"""
        output = """215"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """101
86
119
108
57"""
        output = """481"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """123
123
123
123
123"""
        output = """643"""
        self.assertIO(input, output)

def resolve():
    a=[]
    count=0
    for i in range(5):
        x=int(input())
        if x%10==0:
            count+=x
        else:
            a.append(x)
    if len(a)==0:
        print(count)
    else:
        a.sort(key= lambda xx: xx%10 , reverse= True)

        for i in a[:-1]:
            count+=i-i%10+10
        else:
            count+=a[-1]
        print(count)
if __name__ == "__main__":
    resolve()

Solution (Python):
import math

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

last_menu = min(menu, key=lambda x: (x - 1) % 10)
menu.remove(last_menu)

print(sum(map(lambda x: math.ceil(x / 10) * 10, menu)) + last_menu)

Solution (Python):
import itertools
lst = []
for e in range(5):
    lst.append(int(input()))
ans = 10**9
for pl in list(itertools.permutations(lst)):
    minute = 0
    for i,w in enumerate(pl):
        while True:
            if minute%10 == 0:
                minute += w 
                break
            else:
                minute += 1
    ans = min(ans, minute)
print(ans)

Solution (Python):
dish_list = [int(input()) for _ in range(5)]
last_num_list = [int(str(dish_i)[-1]) for dish_i in dish_list]

if sum(last_num_list) % 10 == 0:
  print(sum(dish_list))
else:  
  target_index = min(list(filter(lambda x: x>0, last_num_list)))

  last_num_min_index = last_num_list.index(target_index)
  ceiling_dish_list = [-10* (-i//10) for i in dish_list]

  print(sum(ceiling_dish_list) - ceiling_dish_list[last_num_min_index] + dish_list[last_num_min_index])

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

min_under10 = 10
min_under10_number = 100
time_10_number = []
for i in range(5):
    tmp = dishes[i] % 10
    if tmp < min_under10 and tmp != 0:
        min_under10 = tmp
        min_under10_number = i
    if tmp == 0:
        time_10_number.append(i)

sum_times = 0
for i in range(5):
    if i != min_under10_number and i not in time_10_number:
        sum_times += (dishes[i] // 10 + 1) * 10
    elif i == min_under10_number:
        sum_times += dishes[i]
    elif i in time_10_number:
        sum_times += dishes[i]

print(sum_times)

Solution (Python):
r = [int(input()) for i in range(5)]
import math
print(sum(sorted([math.ceil(x*0.1)*10 - x for x in r])[:4]) + sum(r))

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

X = [A, B, C, D, E]
Y = [[x, 10-x%10] for x in X]
acc = 0
for y in Y:
    if y[1] == 10:
        acc += y[0]
    else:
        acc += y[0] + y[1]
Z = [10-a%10 for a in X if (10-a%10) < 10]
if Z:
    acc -= max(Z)
print(acc)

Solution (Python):

dishes = [0]*5
last_order = 0
lo_mod = 10
for i in range(5):
    dishes[i] = int(input())
    tmp_mod = dishes[i] % 10

    if (tmp_mod != 0) & (tmp_mod < lo_mod):
        last_order = i
        lo_mod = tmp_mod
count = 0
for i in range(5):
    if i == last_order:
        count += dishes[i]
    else:
        mod = dishes[i] % 10
        if mod != 0:
            count += dishes[i] // 10 * 10 + 10
        else:
            count += dishes[i]
print(count)

Solution (Python):
A = []
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.sort(key=lambda x: x % 10)
ans = 0
isMin = True
for a in A:
  if a % 10 == 0:
    ans += a
  else:
    if isMin:
      ans += a
      isMin = False
    else:
      ans += a // 10 * 10 + 10
print(ans)

Solution (Python):
import math

ans = 0
diff = 0
for m in [ int(input()) for i in range(5) ]:
  time = math.ceil(m / 10) * 10
  ans += time
  diff = max(diff, time - m)
print(ans - diff)

Solution (Python):
menu = [int(input()) for _ in range(5)]
last_order_index = 0
time = 10
for i in range(5):
  if menu[i] % 10 != 0 and time > menu[i] % 10:
    time = menu[i] % 10
    last_order_index = i
cnt = menu[last_order_index]
for j in range(5):
  if j == last_order_index:
    continue
  if menu[j] % 10 != 0:
    cnt += ((menu[j]//10) + 1) * 10
  else:
    cnt += menu[j]
print(cnt)

Solution (Python):
l = []
for _ in range(5):
  l.append(int(input()))
can = []
for i in range(5):
  tmp = 0
  for j in range(5):
    if j == i:
      tmp += l[j]
    else:
      tmp += ((l[j]-1) // 10 + 1) * 10
  can.append(tmp)
print(min(can))

Solution (Python):
time = []
for i in range(5):
  time.append(int(input()))
  
time_diff = [(10-(i%10))%10 for i in time]
time_ten = [i+(10-i%10)%10 for i in time]


max_diff = time_diff.index(max(time_diff))

ans = sum(time_ten) - time_ten[max_diff] + time[max_diff]

print(ans)

Solution (Python):
x=[]
total=[]
for i in range(5):
  t=list(input())
  if t[-1]=='0':
    total.append(t)
  else:
    x.append(t)
x=sorted(x, key=lambda x: x[-1])
for i in range(1,len(x)):
  total.append(x[i])
if len(x)!=0:
  last=int(''.join(x[0]))

for i in range(4):
  total[i]=int(''.join(total[i]))
  total[i]=-(-total[i]//10)*10
if len(x)==0:
  total[-1]=int(''.join(total[-1]))
  print(sum(total))
else:
  print(sum(total)+last)

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

saigo = 9
nonzero = 0
for i in range(5):
    if t[i] % 10 != 0:
        saigo = min(saigo,t[i]%10)
        nonzero += 1
if nonzero == 0:
    saigo = 10

jikan = 0
for i in range(5):
    if t[i] % 10 == 0:
        jikan += t[i]
    else:
        jikan += t[i] + 10 - t[i]%10

jikan -= 10 - saigo
print(jikan)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
dish = [a,b,c,d,e]

total_time=0
next_order=0
max_next=0
for d in dish:
    total_time += d
    if d%10!=0:
        
        next_order=10-d%10
        total_time += next_order
        if next_order > max_next:
            max_next=next_order
total_time-=max_next
print(total_time)

Solution (Python):
x=[int(input()) for i in range(5)]
y=[0]*5
for i in range(5):
  if x[i]%10>0:
    y[i]=(x[i]//10+1)*10
  else:
    y[i]=x[i]
    
z=[x[i]%10 for i in range(5)]
for i in range(5):
  if z[i]==0:
    z[i]=10
    
t=sum(y)-10+min(z)
print(t)

Solution (Python):
import math

time = 0
diff = 0
for i in range(5):
    t = int(input())
    tt = math.ceil(t / 10) * 10
    time += tt
    diff = max(diff, tt-t)
print(time - diff)

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

L2 = [0 for i in range(5)]
time = 0
for i in range(5):
    L2[i] = L[i]%10
    if L2[i] > 0:
        time += L[i]//10*10+10
    else:
        time += L[i]
    
L2.sort()
for i in range(5):
    if L2[i] > 0:
        time -= (10-L2[i])
        break

print(time)

Solution (Python):
x=[int(input())for i in range(5)]
y=0
for i in range(5):
    y+=x[i]+(-x[i]%10)
z=max(-x[i]%10 for i in range(5))
print(y-z)

Solution (Python):
import math
xs = [int(input()) for _ in range(5)]
print(sum(xs) + sum(sorted([math.ceil(x*0.1)*10 - x  for x in xs])[:4]))

Solution (Python):
x = [int(input()) for _ in range(5)]
y = []
sum_x = 0
for i in range(5):
    if x[i]%10 != 0:
        sum_x += (x[i]//10)*10+10
        y.append(x[i]%10)
    else:
        sum_x += x[i]
if len(y) != 0:
     sum_x = sum_x + min(y) - 10
print(sum_x)

Solution (Python):
A = [int(input()) for i in range(5)]
mod_list = [a % 10 for a in A]
mod_list = [10 if a == 0 else a for a in mod_list]

comb_list = [[a, b] for a, b in zip(A, mod_list)]
sort_list = sorted(comb_list, key=lambda x: -x[1])

res = 0

for i, a in enumerate(sort_list):
    if i < 4:
        res += a[0] + (10-a[1])
    else:
        res += a[0]

print(res)

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

min_fraction = 9
min_fraction_index = 0
for i in range(5):
    if cooking_time[i] % 10 != 0 and cooking_time[i] % 10 < min_fraction:
        min_fraction = cooking_time[i] % 10
        min_fraction_index = i



total_time = 0
for i in range(5):
    if i != min_fraction_index:
        if cooking_time[i] % 10 != 0:
            total_time += ((cooking_time[i] // 10) + 1) * 10
        else:
            total_time += cooking_time[i]
total_time += cooking_time[min_fraction_index]

print(total_time)

Solution (Python):
x=[]
x=[int(input()) for _ in range(5)]
print(sum(map(lambda i:-(-i//10*10)-i,x))+sum(x)-max(map(lambda i:-(-i//10*10)-i,x)))

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

min_remainder_num = 0
for i in range(1, 5):
    if order_list[min_remainder_num]%10 > order_list[i]%10 > 0:
        min_remainder_num = i

ans = 0

for j in range(5):
    if j == min_remainder_num:
        ans += order_list[j]
    else:
        ans += -((-1 * order_list[j])//10)*10

print(ans)

Solution (Python):
A,B,C,D,E=(int(input()) for i in range(5))
def m(x):
    if x%10==0:
        return x
    else:
        return((x//10)+1)*10
      
a=m(A)
b=m(B)
c=m(C)
d=m(D)
e=m(E)
aa=A+b+c+d+e
bb=a+B+c+d+e
cc=a+b+C+d+e
dd=a+b+c+D+e
ee=a+b+c+d+E
print(min(aa,bb,cc,dd,ee))

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

print(sum(A) + sum(B) - max(B))

Solution (Python):
import math
k=[]
sa=[]
for i in range(5):
	a = int(input())
	j=math.ceil(a/10)*10
	k.append(j)
	m=j-a
	sa.append(m)
print(sum(k)-max(sa))