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):
from math import ceil
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

L=[A,B,C,D,E]
X=[]
for l in L:
    res=ceil(l*0.1)*10
    
    X.append([res,l,res-l])
X=sorted(X, key=lambda x: x[2], reverse=True)
ans=0
for i,x in enumerate(X):
    res,l=x[0],x[1]
    if i==0:
        ans+=l
    else:
        ans+=res

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  





A = list(map(int, open(0).read().split()))
ans = 0
B = []
for a in A:
    ans += (a - 1) // 10 + 1
    B.append(10 - a % 10 if a % 10 != 0 else 0)

print(ans * 10 - max(B))

Solution (Python):
p = [int(input())for i in range(5)]
perm  =[0]*5
used = [0]*5
nums = []
def dfs(now):
    if now == 5:
        nums.append([perm[i]for i in range(5)])
        
        
        return
    for i in range(5):
        if used[i]:continue
        used[i] = 1
        perm[now] = i
        dfs(now+1)
        used[i] = 0
dfs(0)

ans = 10**19
for l in nums:
    time = 0
    
    for i in range(5):
        
        time +=p[l[i]]
        if i == 4:break
        
        for i in range(10):
            
            if time%10 == 0:
                break
            time +=1
    ans = min(ans,time)
print(ans)

Solution (Python):
ans = 0
y = []
z = []
for i in range(5):
    X = int(input())
    if X % 10 != 0:
        y.append(10 - X%10)
    z.append(X)

if len(y)>0:
    print(sum(z) + sum(y) - max(y))
else:
    print(sum(z))

Solution (Python):
A = []
ans = 0
for _ in range(5):
  a = int(input())
  if a % 10 == 0: ans += a
  else: A.append(a)
if len(A) > 0:
  A.sort(key = lambda x:x%10)
  ans += A[0]
  for a in A[1:]:
    ans += a + 10 - a%10
print(ans)

Solution (Python):
from math import ceil
a=[int(input())for i in range(5)]
m=1000
idx=100
for i,aa in enumerate(a):
  t=str(aa)
  t=t[-1]
  t=int(t)
  if 0<t<=m:
    m=t
    idx=i
ans=0
for i,aa in enumerate(a):
  if i==idx:
    ans+=aa
    continue
  ans+=ceil(aa/10)*10
print(ans)

Solution (Python):
dishes = []
for i in range(5):
    time = int(input())
    diff = (10 - time % 10) % 10
    dishes.append([time, diff])
dishes = sorted(dishes, key=lambda x: x[1])
ans = 0
for i in range(4):
    time = dishes[i][0]
    ans += time + dishes[i][1]
ans += dishes[-1][0]
print(ans)

Solution (Python):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
import sys
input = sys.stdin.readline


INF = float("inf")


def main():
    l = [int(input()) for _ in range(5)]
    r = INF
    for i in range(5):
        if l[i] % 10 == 0:
            continue
        r = min(r, l[i] % 10)
    if r != INF:
        ans = sum([math.ceil(i / 10) * 10 for i in l]) - 10 + r
    else:
        ans = sum(l)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
a = [int(input()) for _ in range(5)]
mn = 100
for i in range(5):
    amari = a[i]%10
    if a[i]%10==0:
        amari = 10
        
    if mn>amari:
        mn = amari
        mn1 = i
        
ans = 0
for i in range(5):
    if i==mn1:
        continue
    else:
        if a[i]%10==0:
            ans1 = a[i]//10
        else:
            ans1 = (a[i]//10)+1
        ans += (ans1)*10
ans += a[mn1]
print(ans)

Solution (Python):
def resolve():
    import math
    a = [int(input()) for _ in range(5)]
    b = []
    for i in range(5):
        if a[i]%10 != 0:
            b.append(a[i]%10)
    if len(b) == 0:
        amin = 10
    else:
        amin = min(b)
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
    print(ans-10+amin)

resolve()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    ans = 0
    a = 10**3
    for i in range(5):
        x = int(input())
        ans += ((x + 9) // 10) * 10
        aa = x % 10
        if aa == 0:
            continue
        a = min(a, aa)
    if a == 10 ** 3:
        a = 10
    ans -= 10 - a
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):


from itertools import permutations
import math


nums = [0]*5
for i in range(5):
    n = int(input())
    nums[i] = n


pattern_moto = [i for i in range(5)]
patterns = permutations(pattern_moto)
min_time = 1000


for p in patterns:
    tmp = 0
    for i in range(4):
        tmp += nums[p[i]]
        tmp = math.ceil(tmp/10)*10
    tmp += nums[p[4]]
    min_time = min(min_time, tmp)


print(min_time)

Solution (Python):
from itertools import permutations
A = [int(input()) for _ in range(5)]
cmin = 10**4
for x in permutations(range(5),5):
    cnt = A[x[0]]
    if cnt%10>0:
        cnt = (cnt//10)*10+10
    for i in range(1,4):
        cnt += A[x[i]]
        if cnt%10>0:
            cnt = (cnt//10)*10+10
    cnt += A[x[4]]
    cmin = min(cmin,cnt)
print(cmin)

Solution (Python):
l = [int(input()) for _ in range(5)]
l.sort(key=lambda x: 10 if x%10==0 else x%10)
l = l[::-1]
ans = 0
for i in range(5):
    if i == 4 or l[i]%10==0:
        ans += l[i]
    else:
        ans += ((l[i]//10)+1)*10
print(ans)

Solution (Python):
def main():
    A = [int(input()) for i in range(5)]
    B = []
    for a in A:
        if a % 10 == 0:
            B.append(a)
        else:
            B.append((1+a//10)*10)
    ans = sum(B)
    maxV = max(A, key=lambda x: (10 - x % 10) % 10)
    print(ans - (10 - maxV % 10) % 10)


if __name__ == '__main__':
    main()

Solution (Python):
menu = []

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

from itertools import permutations
from math import ceil

min_sum = 10**10
for i in permutations(menu, 5):
    sum = 0
    for j in range(4):
        sum += ceil(i[j]/10) * 10
    sum += i[4]
    if sum < min_sum:
        min_sum = sum

print(min_sum)

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

abcde.sort(key=lambda x: (x % 10))

flag = False
ans = 0
for x in abcde:
    if x % 10 == 0 or flag:
        if x % 10 == 0:
            ans += x
        else:
            ans += ((x//10)+1)*10
    else:
        ans += x
        flag = True
print(ans)

Solution (Python):
def resolve():
  a = int(input())
  b = int(input())
  c = int(input())
  d = int(input())
  e = int(input())
  x = 10
  if a%10 != 0:
    x = min(x, a%10)
    a = a - a%10 + 10
  if b%10 != 0:
    x = min(x, b%10)
    b = b - b%10 + 10
  if c%10 != 0:
    x = min(x, c%10)
    c = c - c%10 + 10
  if d%10 != 0:
    x = min(x, d%10)
    d = d - d%10 + 10
  if e%10 != 0:
    x = min(x, e%10)
    e = e - e%10 + 10

  ans = (a + b + c + d + e) - 10 + x
  print(ans)

  return

if __name__ == "__main__":
  resolve()

Solution (Python):
from math import ceil

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

mmin = 10
ans = 0
for ai in A:
    ans += 10*ceil(ai/10)
    if ai%10 != 0:
        mmin = min(mmin, ai%10)
if mmin%10 == 0:
    print(ans)
else:
    print(ans - 10 + mmin)

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



B = [(10-a % 10) % 10 for a in A]
C = [-(-a//10)*10 for a in A]
print(sum(C)-max(B))

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

from itertools import permutations

LL = list(permutations(LL))

ans = float("inf")
for L in LL:
    res = 0
    for l in L[:-1]:
        res += (l + 10 - 1) // 10 * 10
    res += L[-1]
    ans = min(ans, res)

print(ans)

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
import itertools
a = list(itertools.permutations(a, 5))
ans = int(1e10)
for i in range(len(a)):
    cnt = 0
    for j in range(5):
        if j != 4:
            cnt += (a[i][j]+9)//10*10
        else:
            cnt += a[i][j]
    ans = min(ans, cnt)
print(ans)

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

Solution (Python):
from itertools import permutations as perm

l = [int(input()) for _ in range(5)]
res = 10 ** 100
for p in perm(l):
    tmp = 0
    for i in p:
        tmp = (tmp + 9) // 10 * 10
        tmp += i
    res = min(res, tmp)
print(res)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return


def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    B()

Solution (Python):

import math

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

last_dish_index = 0
from10 = 0

for i in range(len(dishes)):
    tmp = dishes[i] % 10
    if tmp != 0 and 10 - tmp > from10:
        last_dish_index = i
        from10 = 10 - tmp % 10

last_dish = dishes.pop(last_dish_index)
print(sum([math.ceil(t / 10) * 10 for t in dishes]) + last_dish)

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

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

last_index = -1
last_t = 10
for i in range(len(a)):
    if (a[i]-1) % 10 < last_t:
        last_t = (a[i]-1) % 10
        last_index = i

total = 0
for i in range(len(a)):
    if i == last_index:
        total += a[i]
    else:
        total += a[i] if a[i] % 10 == 0 else 10 * (a[i] // 10 + 1)

print(total)

Solution (Python):
order_li= [int(input()) for i in range(5)]
loss_li = [0 if order%10==0 else 10-order%10 for order in order_li]

ans = sum(order_li)+sum(loss_li)-max(loss_li)
print(ans)

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

import math

max=0
sum=0
for a in T:
  if 10-a%10>max and a%10!=0:
    max=10-a%10
  sum += math.ceil(a/10)*10
sum -= max  
print(sum)

Solution (Python):

import math
a = []
a1 = []
f = 10
for i in range(5):
    a.append(int(input()))
    a1.append(math.ceil(a[i] / 10) * 10)
    if f > a[i] % 10 and a[i] % 10 != 0:
        f = a[i] % 10

print(sum(a1) - 10 + f)

Solution (Python):
from itertools import permutations

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

min_time = 99999999999999
for xs in list(permutations(x)):
  total = 0
  for i in range(5):
    if i != 4:
      hoge = xs[i] // 10 if xs[i] % 10 == 0 else xs[i] // 10 + 1
      total += hoge * 10
      
    else:
      total += xs[i]
      
  min_time = min(total, min_time)
print(min_time)

Solution (Python):
S = [int(input()) for i in range(5)]
R = list(S)
for i in range(5):
    R[i]=R[i]%10

for i in range(5):
    if R[i]!=0:
        R[i]=10-R[i]
w=sorted(R)

W=w[0]+w[1]+w[2]+w[3]
ans = sum(S) + W

print(ans)

Solution (Python):
S=[int(input()) for i in range(5)]
R=list(S)
for i in range(5):
    R[i]=R[i]%10
L=sorted(R)[::-1]

for i in range(5):
    if L[i]!=0:
        L[i]=10-L[i]
W=sorted(L)

total=S[0]+S[1]+S[2]+S[3]+S[4]
mati=W[0]+W[1]+W[2]+W[3]
print(total+mati)

Solution (Python):
import math
a=[]
a1=[]
f=0
for i in range(5):
    a.append(int(input()))
    a1.append(math.ceil(a[i]/10)*10)
    if 10-a[i]%10>=f and a[i]%10!=0:
        f=10-a[i]%10
        
print(sum(a1)-f)

Solution (Python):
import math

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

ceil = lambda number: math.ceil(number / 10) * 10

minutes = [A, B, C, D, E]
ceiled_minutes = list(map(ceil, minutes))

minimum = 10
for minute in minutes:
    digit_1st = minute % 10
    if digit_1st == 0: continue

    if minimum is None or digit_1st < minimum:
        minimum = digit_1st
diff = 10 - minimum

answer = sum(ceiled_minutes) - diff

print(answer)

Solution (Python):
import math

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

ceil = lambda number: math.ceil(number / 10) * 10

minutes = [A, B, C, D, E]
ceiled_minutes = list(map(ceil, minutes))

maximum_diff = 0
for minute in minutes:
    ceiled = ceil(minute)
    diff = ceiled - minute
    if diff == 0: continue

    if maximum_diff is None or diff > maximum_diff:
        maximum_diff = diff

answer = sum(ceiled_minutes) - maximum_diff
    
print(answer)

Solution (Python):
import math

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

ceil = lambda number: math.ceil(number / 10) * 10
ceiled_A = ceil(A)
ceiled_B = ceil(B)
ceiled_C = ceil(C)
ceiled_D = ceil(D)
ceiled_E = ceil(E)

maximum_diff = 0
for minitues in [A, B, C, D, E]:
    ceiled = ceil(minitues)
    diff = ceiled - minitues
    if diff == 0: continue

    if maximum_diff is None or diff > maximum_diff:
        maximum_diff = diff

answer = ceiled_A + ceiled_B + ceiled_C + ceiled_D + ceiled_E - maximum_diff
    
print(answer)

Solution (Python):
def main():
    ans, m_rem = 0, 0
    for _ in range(5):
        m = int(input())
        rem = m % 10
        if rem == 0:
            ans += m
        else:
            m_rem = max(m_rem, 10 - rem)
            ans += m + 10 - rem
    print(ans - m_rem)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import permutations
lst = []
for _ in range(5):
    lst.append(int(input()))
    
ans = float('inf')
for p in permutations(lst):
    elsp = 0
    for i, k in enumerate(p):
        if i <= 3:
            elsp += k
            tmp = elsp//10
            if elsp%10==0:
                elsp = tmp*10
            else:
                elsp = (tmp+1)*10
        else:
            elsp += k
    if elsp <= ans:
        ans = elsp
print(ans)

Solution (Python):
menu,fir_digi=[int(input()) for i in range(5)],[]
for i in range (5):
    fir_digi.append(menu[i]%10)
while min(fir_digi)==0:
    fir_digi[fir_digi.index(0)]=10
for i in range (5):
    if i!=fir_digi.index(min(fir_digi)) and fir_digi[i]!=10:
            menu[i]=int(menu[i]/10)*10+10
print(sum(menu))

Solution (Python):
num = []
t_sum = 0

for i in range(5):
    t = int(input())
    t_sum += t
    if t%10 == 0:
        num.append(0)
    else:
        num.append(10-t%10)
num = sorted(num)

ans = 0
for i in range(len(num)-1):
    ans += num[i]

print(ans + t_sum)

Solution (Python):
str_menu,int_menu,fir_digi,ans=[str(input()) for i in range(5)],[],[],0
for i in range (5):
    fir_digi.append(int(str_menu[i][-1]))
    int_menu.append(int(str_menu[i]))
while min(fir_digi)==0:
    fir_digi[fir_digi.index(0)]=10

for i in range (5):
    if i!=fir_digi.index(min(fir_digi)):
        if fir_digi[i]!=10:
            int_menu[i]=int(int_menu[i]/10)*10+10
    ans=ans+int_menu[i]
print(ans)

Solution (Python):
import sys

a = input()
b = input()
c = input()
d = input()
e = input()
tmp = [a,b,c,d,e]
l = [int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]

minimum = 10
num = 0
for i in range(5):
	if minimum > l[i] and l[i] != 0:
		minimum = l[i]
		num = i

ans = 0
for i in range(5):
	if i != num:
		if l[i] != 0:
			add = 10 - l[i]
		else:
			add = 0
		ans += int(tmp[i]) + add

ans += int(tmp[num])
print(ans)

Solution (Python):
l = [int(input()) for _ in range(5)]
ans = 0
m = []
for i in range(5):
    if l[i] % 10 != 0:
        m.append(l[i] % 10)
m.sort()
for i in l:
    if i % 10 != 0:
        ans += ((i // 10) + 1) * 10
    else:
        ans += i
if m != []:
    print(ans - 10 + m[0])
else:
    print(ans)

Solution (Python):
icase=0
if icase==0:
    from itertools import permutations, combinations,combinations_with_replacement,product
    a=[0]*5
    for i in range(5):
        a[i]=int(input())
    tmin=130*5+1
    alist=list(permutations(a))
    for ai in alist:
        t=ai[0]
        t=int((t-1)//10+1)*10+ai[1]
        t=int((t-1)//10+1)*10+ai[2]
        t=int((t-1)//10+1)*10+ai[3]
        t=int((t-1)//10+1)*10+ai[4]
        tmin=min(t,tmin)
    print(tmin)

Solution (Python):
dishes = []
serve = []
for i in range(5):
    dish = int(input())
    dishes.append(dish)
    if dish % 10 != 0:
        time = 10 - dish%10
        serve.append(time)
if serve == []:
    print(sum(dishes))
else:
    sort_serve = sorted(serve)
    sort_serve.remove(sort_serve[len(sort_serve)-1])
    ans = sum(dishes) + sum(sort_serve)
    print(ans)

Solution (Python):
t=[]
max_time=999
flg=False
for i in range(5):
    t.append(int(input()))
    if (t[i]%10)<max_time and (t[i]%10)!=0:
        max_time=(t[i]%10)
        flg=True
    if t[i]%10!=0:
        t[i]+=10-(t[i]%10)
if flg:
    print(sum(t)-(10-max_time))
else:
    print(sum(t))

Solution (Python):
N = [int(input()) for _ in range(5)]
n = [10 - x % 10 if x % 10 != 0 else 0 for x in N]

ans = sum(N) + sum(n) - max(n)
print(ans)

Solution (Python):
A = [int(input()) for _ in range(5)]
cnt = 0
Max = 10
Max_i = 0
for i in range(len(A)):
    if 0 < A[i]%10 < Max:
        Max = A[i]%10
        Max_i = i
for i in range(len(A)):
    if i != Max_i:
        cnt += A[i]
    while cnt%10 != 0:
        cnt += 1
print(cnt+A[Max_i])

Solution (Python):
def main():
  A = int(input())
  B = int(input())
  C = int(input())
  D = int(input())
  E = int(input())
  
  a = (10 - A) % 10
  b = (10 - B) % 10
  c = (10 - C) % 10
  d = (10 - D) % 10
  e = (10 - E) % 10
 
  print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))
  
  
  
if __name__ == '__main__':
  main()

Solution (Python):
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  A = int(input())
  B = int(input())
  C = int(input())
  D = int(input())
  E = int(input())
  
  a = (10 - A) % 10
  b = (10 - B) % 10
  c = (10 - C) % 10
  d = (10 - D) % 10
  e = (10 - E) % 10
 
  print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))
  
  
  
if __name__ == '__main__':
  main()

Solution (Python):
from itertools import permutations

l = [int(input()) for _ in range(5)]
res = 10**9
for r in permutations(l, r=5):
    x = 0
    for i in range(4):
        x += r[i]
        if r[i]%10>0:
            x += 10-r[i]%10
    x += r[-1]

    res = min(res, x)
print(res)

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

lis = [a,b,c,d,e]
lis2 = [999]*5
for i in range(5):
  if lis[i]%10==0:
    lis2[i] = 10
  else:
    lis2[i] = lis[i]%10

last = lis2.index(min(lis2))
total = 0
for i in range(5):
  if i ==last:
    total += lis[i]
  else:
    total += -(-lis[i]//10)*10
    
print(total)

Solution (Python):
import itertools


D = [int(input()) for _ in range(5)]
min_time = 1000
for p in itertools.permutations(range(5)):
    time = 0
    for i in range(5):
        time += D[p[i]]
        if i < 4:
            dm = D[p[i]]%10
            time += 0 if dm == 0 else 10-dm
    min_time = min(min_time, time)
print(min_time)

Solution (Python):
def main():
    menu = [ input() for a in range(5)]
    time = 0
    for i in range(len(menu)):
        if int(menu[i]) % 10 == 0:
            time += int(menu[i])
            menu[i] = "0"
    if len(menu) > 0:
        for i in range(menu.count("0")):
            menu.remove("0")
    if len(menu) > 0:
        menu.sort(key = (lambda x: 10 - int(x[-1])))

        for i in range(len(menu) - 1):
            time += int(menu[i]) + 10 - int(menu[i][-1])
        time += int(menu[-1])
    print(time)
main()

Solution (Python):


dishes = [int(input()) for i in range(5)]
lest_time = 0
ans = 0
for dish in dishes:
    if dish%10==0:
        ans += (dish)
    else:
        ans += (dish+10-dish%10)
    if lest_time < 10-dish%10 and dish%10!=0:
        lest_time = 10-dish%10
print(ans-lest_time)

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = [ir() for _ in range(5)]
ceil_time = [(x+9)//10*10 for x in A]
can_save = [y - x for y, x in zip(ceil_time, A)]
answer = sum(ceil_time) - max(can_save)
print(answer)

Solution (Python):
time=[int(input()) for _ in range(5)]
t1=[10]*5
for i in range(5):
  if time[i]%10!=0:
    t1[i]=time[i]%10
last=min(t1)
t=0
a=0
for i in range(5):
  if a==0 and t1[i]==last:
    t+=time[i]
    a=1
  else:
    t+=time[i]-t1[i]+10
print(t)

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

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li == []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Solution (Python):
abcde = list(map(int, open(0).read().split()))

minimum = abcde[0] % 10
num = 0
for i in range(len(abcde)):
    if abcde[i] % 10 < minimum and abcde[i] % 10 != 0:
        minimum = abcde[i] % 10
        num = i

ans = 0
for i in range(len(abcde)):
    if i == num:
        ans += abcde[i]
        continue
    
    if abcde[i] % 10 != 0:
        ans += (abcde[i] // 10 + 1) * 10
    else:
        ans += abcde[i]
        
print(ans)

Solution (Python):

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = np.zeros(5, np.int32)
for i in range(5):
    A[i] = ir()

remain = A % 10
remain = remain[remain>0]
ceil10 = (np.ceil(A/10) * 10).astype(np.int32)
answer = ceil10.sum()
if len(remain) != 0:
    minus = 10 - remain.min()
    answer -= minus
print(answer)

Solution (Python):
import math
l = [int(input()) for i in range(5)]
ans = 0
c = 0
for i in l:
    times = math.ceil(i/10)*10-i
    if times != 0:
        c = max(c, times)
    ans += math.ceil(i/10)*10
print(ans-c)

Solution (Python):
import math
ans=0
A=list()
M=list()
for i in range(5):
  a = int(input())
  if(a%10!=0):
    M.append(a%10)
  b=int(math.ceil(a/10)*10)
  A.append(b)
  ans+=b

if not M:
  print(ans)
else:
  ans+=min(M)-10
  print(ans)

Solution (Python):

l = [input() for _ in range(5)]
m = 11
ans = 0
for i in range(len(l)):
    n = int(l[i][-1])
    if n == 0: n = 10
    if n < m:
        m = n
        ind = i
for t in range(len(l)):
    if t == ind:
        ans += int(l[t])
    else:
        n = int(l[t][-1])
        if n == 0: n = 10
        ans += (int(l[t]) + 10 - n)
print(ans)

Solution (Python):
import math
x=0
ans=0
for i in range(5):
  a=int(input())
  b=math.ceil(a/10)*10
  x=max(x,b-a)
  ans+=b
print(ans-x)

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

import math
ans = 0
minmod = 10
for i in range(5):
  if time[i]%10!=0:
    minmod = min(minmod,time[i]%10)
  else:
    minmod = min(minmod,10)
  ans += math.ceil(time[i]/10)*10

ans -= (10-minmod)
print(ans)

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

for i in range(5):
    C.append(B[i]-A[i])
print(sum(B)-max(C))

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

for i in range(5):
    if A[i] % 10 != 0:
        tmp = min(tmp, A[i] % 10)
        A[i] = A[i] // 10 * 10 + 10

print(sum(A) - (10 - tmp))

Solution (Python):
import math
Time=[int(input()) for _ in range(5)]
amari=[math.ceil(Time[i]/10)*10 for i in range(5)]

last=min((Time[i]-1)%10 for i in range(5))
last+=1

print(amari[0]+amari[1]+amari[2]+amari[3]+amari[4]+last-10)

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

for i in f:
    n += ((i - 1) // 10 + 1) * 10

g = [(f[i] - 1) % 10 + 1 for i in range(5)]
n = n - 10 + min(g)
print(n)

Solution (Python):
import math
A = [int(input()) for _ in range(5)]
B = 10
ans = 0
for i in range(5):
  if A[i] % 10 < B and A[i]%10 > 0:
    B = A[i] % 10
    ans = -10+B
for j in A:
  ans += math.ceil(j/10)*10
print(ans)

Solution (Python):
A = 0
B = []
B.append(0)
for i in range(5):
  I = int(input())
  A += I
  T = I % 10
  if T != 0:
    B.append(10 - T)
print(A + sum(B) - max(B))

Solution (Python):
import math
a = [int(input()) for _ in range(5)]
tempo_total = 0
entrega = 0
for i in range(5):
    resto = 10 - a[i] % 10
    if resto > entrega and resto != 10:
        entrega = resto
tempo_total -= entrega
for item in a:
    tempo_total += math.ceil(item/10) * 10
print(tempo_total)

Solution (Python):
import math
lost_max=0
time=0
for _ in range(5):
    x=int(input())
    time+=math.ceil(x/10)*10
    lost_max=max(math.ceil(x/10)*10-x,lost_max)
print(time-lost_max)

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

maxv = 0
b = 4
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)

Solution (Python):
import math
A = [int(input()) for _ in range(5)]
B = 10
ans = 0
for i in range(5):
  if A[i] % 10 < B and A[i]%10 > 0:
    B = A[i] % 10
    ans = -10+B
for j in A:
  ans += math.ceil(j/10)*10
print(ans)

Solution (Python):
import itertools
def func(n,j):
   if(n % 10 == 0 or j==4):
      return n
   return n //10 * 10 + 10
def myAnswer(A:int,B:int,C:int,D:int,E:int) -> int:
   dishes = [A,B,C,D,E]
   ans = 10**9
   for i in itertools.permutations(dishes):
      total = 0
      for j,a in enumerate(i):
         total+= func(a,j)
      ans = min(total,ans)
   return ans


def modelAnswer():
   tmp=1
def main():
   A = int(input())
   B = int(input())
   C = int(input())
   D = int(input())
   E = int(input())
   print(myAnswer(A,B,C,D,E))

if __name__ == '__main__':
   main()

Solution (Python):
X = [int(input()) for _ in range(5)]
ans = 0
Y = []
for i in range(len(X)):
    Y.append(X[i] % 10 if X[i] % 10 != 0 else 10)

m = Y.index(min(Y))

for j in range(len(X)):
    if j == m:
        ans += X[j]
    elif X[j] % 10 == 0:
        ans += X[j]
    else:
        ans += X[j]//10 * 10 + 10

print(ans)

Solution (Python):
A=[]
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
count=0
rem=10
for t in A:
    if t%10==0:
        count+=t
    else:
        count+=(((t//10)+1)*10)
        if t%10<rem:
            rem=t%10
print(count-10+rem)

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

sum = 0
sorted_list = []
for l in lista:
    diff = 10-int(str(l)[len(str(l))-1])
    if diff == 10:
        diff = 0
    sorted_list.append((diff, l))
sorted_list.sort()
pos = 0
for s in sorted_list:
    if pos < len(sorted_list)-1:
        sum+=(s[0]+s[1])
    else:
        sum+=s[1]
    pos+=1
print(sum)

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


def lastDigit(x):
    return x % 10


xs.sort(key=lastDigit)

time = 0
first = True
for x in xs:
    if x % 10 == 0:
        time += x
    else:
        if first:
            time += x
            first = False
        else:
            time += x + 10 - x % 10
print(time)

Solution (Python):
import math

ans = 0
cost = 0
time_list = [int(input()) for i in range(5)]
for i in time_list:
    if math.ceil(i / 10) * 10 - i != 0:
        cost = max(cost,math.ceil(i / 10) * 10 - i)
    ans += math.ceil(i / 10) * 10
print(ans - cost)