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):
data = []
for i in range(5):
    data.append(int(input()))

time = 0
for dish_time in data:
    time += (dish_time + 9) // 10 * 10

time -= max([10 - time % 10 for time in data if time % 10] + [0])

print(time)

Solution (Python):
t = [int(input()) for i in range(5)]
T = [(-(-i//10))*10 for i in t]
t_min = [i%10 for i in t]
t_min = min([i for i in t_min if i != 0]) if t_min != [0 for i in range(5)] else 10
print(sum(T) - 10 + t_min)

Solution (Python):
a,b=[],[]
c,time=0,0
for i in range(5):
  c=int(input())
  a.append(c)
  if c%10==0:
    b.append(10-c%10)
  else:
    b.append(c%10)
for i,j in enumerate(b):
  if j==10:
    time+=a[i]
  else:
    time+=a[i]+10-j

print(time-10+min(b))

Solution (Python):
l = list(int(input()) for i in range(5))
nlist = []
Sum = 0

for i in range(5):
    if l[i]%10 == 0:
        nlist.append(0)
    else:
        nlist.append(10 - (l[i]%10))
        
if nlist[0] == nlist[1] == nlist[2] == nlist[3] == nlist[4] == 0:
    print(l[0]+l[1]+l[2]+l[3]+l[4])
else:
    
    for i in range(5):
        Sum += l[i] + nlist[i]
    print(Sum - max(nlist))

Solution (Python):
import math
arr = []
tmp = 0
rem = 10
ans = 0
for i in range(5):
    x = int(input())
    arr.append(x)
    if (x%10 < rem) and (x%10 >0):
        rem = x % 10
        tmp = x
for item in arr:
    if item == tmp:
        arr.remove(item)
        arr.append(item)
for item in arr:
    ans+= math.ceil(item/10)*10
print (ans - 10 + rem)

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

for i in range(5):
    if l[i]%10 == 0:
        A.append(0)
    else:
        A.append(10-(l[i]%10))
    
if A[0]==A[1]==A[2]==A[3]==A[4]==0:
    print(l[0]+l[1]+l[2]+l[3]+l[4])
else:
    for k in range(5):
        sum += l[k]+A[k]
    print(sum-max(A))

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

def ceilOnesPlace(i:int):
    return int((i + 9) / 10) * 10

S = sum([ceilOnesPlace(con) for con in ipt])

S -= max([(10 - (con%10))%10 for con in ipt])

print(S)

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

minnum = 1000
minidx = 6
for i, con in enumerate(ipt):
    if con % 10 != 0:
        if minnum > con % 10:
            minnum = con % 10
            minidx = i

print(sum([int((con+9)/10)*10 if i != minidx and con%10 != 0 else con for i,con in enumerate(ipt)]))

Solution (Python):

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

b = []
c = 9
d = -1
if (a[0] % 10 == 0 and a[1] % 10 == 0 and a[2] % 10 == 0 and a[3] % 10 == 0 and a[4] % 10 == 0):
  time = 0
  for i in range (5):
    time += a[i]
else:
  for i in range (5):
    m = a[i] % 10
    if m == 0:
      b += [a[i]]
    elif c >= m:
      c = m
      b += [((d // 10) + 1) * 10]
      d = a[i]
    else:
      b += [(a[i] // 10 + 1) * 10]
  time = d
  for i in range (5):
    time += b[i]
print(time)

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

m = 10
a = [A, B, C, D, E]

for i in range(len(a)):

 if a[i] % 10 <= m and a[i] % 10 != 0:
     m = a[i] % 10


for j in range(len(a)):
  if a[j] % 10 != 0:
     a[j] = a[j] + (10 - a[j] % 10)

print(sum(a) - (10 - m))

Solution (Python):


ans=10
a=0
for i in range(5):
    t=int(input())
   
    l=t%10 
    a+=t+(10-l)
    if(l==0):
        a-=10
    if(l!=0 and l<ans):
        ans=l
    
print(a-(10-ans))

Solution (Python):
ans = 0
for _ in range(5):
    i = int(input())
    if i % 10 == 0:
        ans += i
    elif ans % 10 == 0:
        ans += i
    else:
        if ans % 10 > i % 10:
            ans = (ans // 10 + 1) * 10
            ans += i
        else:
            ans += (i // 10 + 1) * 10
print(ans)

Solution (Python):
A = []
for i in range(5):
    a = int(input())
    A.append(a)
min_mod = 10
mod_list = []
for a in A:
    if a % 10 == 0:
        min_mod = min(min_mod, 10)
    else:
        min_mod = min(min_mod, a % 10)
    mod_list.append(a % 10)
for i,m in enumerate(mod_list):
    if m == min_mod:
        break
ans = 0
for j in range(5):
    if j == i:
        continue
    ans += (A[j] // 10) * 10 + 10 * ((A[j] % 10) > 0)
ans += A[i]
print(ans)

Solution (Python):
import math
T = [int(input()) for i in range(5)]
m = [(T[i]+9)%10 for i in range(5)]
idx = m.index(min(m))
d = m[idx]+1
result = sum([math.ceil(T[i]/10)*10 for i in range(5)])
result -= 10 - d
print(result)

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

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

aa = [int(input()) for _ in range(5)]
ans = 0
tmp = INF
for a in aa:
    ans += (a-1)//10 * 10 + 10
    tmp = min(tmp,(a-1)%10+1)

print(ans+tmp-10)

Solution (Python):

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

m = list(map(lambda x:(x-1)%10,n))
min_m_idx = m.index(min(m))

l = list(map(lambda x:math.ceil(x/10)*10,n))
del l[min_m_idx]
print(n[min_m_idx] + sum(l))

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

total = 0
compare = 0
largest = 0

if sum(food)%10 == 0:
    print(sum(food))

else:
    for x in food:
        if (10 - (x % 10) > compare) and ((x % 10) != 0):
            largest = x
            compare = 10 - (x % 10)

    food.remove(largest)

    for i in range(len(food)):
        if food[i] % 10 != 0:
            total += round(food[i] + 5.1, -1)
        else:
            total += food[i]

    print(int(total+largest))

Solution (Python):
tot = 0
m = 0
for i in range(5):
    s = int(input())
    if s % 10 == 0:
        rem = 0
    else:
        rem = s%10 - 10
        s = 10*(s//10 + 1)
    m = min(m, rem)
    tot += s

print(tot+m)

Solution (Python):
class Dish:

    dish_sum = 0
    dish_max = 0

    def __init__(self,value):
        self.value = value
        self.diff = (10 - value) % 10
        Dish.dish_sum += self.value + self.diff
        Dish.dish_max = self.diff if Dish.dish_max < self.diff else Dish.dish_max


dishes = [Dish(int(input())) for i in range(5)]
print(Dish.dish_sum - Dish.dish_max)

Solution (Python):
import numpy as np
from itertools import permutations


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


def calc(menus):
  t = 0
  for i, menu in enumerate(menus):
    t += menu
    if i < 4:
	    t = np.ceil(t / 10) * 10
  return t

minima = np.inf
for menu in permutations(menus):
  minima = min(minima, calc(menu))
print(int(minima))

Solution (Python):
waitTime = []
_time = 0
for i in range(0,5):
    t, mod = divmod(int(input()), 10)
    _time += (t * 10)
    if mod != 0:
        waitTime.append(mod)
if len(waitTime) > 0:
    waitTime = sorted(waitTime, reverse= True)
    _time += (len(waitTime) - 1) * 10
    _time += min(waitTime)
print(_time)

Solution (Python):
import math

ans = 0
maxRemain = 0

for i in range(5):
    a = int(input())

    rn = math.ceil(a/10)*10
    ans = ans + rn 

    if maxRemain < (rn - a):
        maxRemain = rn - a

print(ans-maxRemain)

Solution (Python):
import math

inputList = []
for i in range(5):
    a = int(input())
    inputList.append((math.ceil(a/10)*10 - a, a))

inputList.sort()

ans = 0
for i in range(4):
    ans = ans + inputList[i][0] + inputList[i][1]

ans = ans + inputList[4][1]
print(ans)

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

a_s = (a + (10 - a%10) if (a%10 != 0) else a)
a_a = a%10
b_s = (b + (10 - b%10) if (b%10 != 0) else b)
b_a = b%10
c_s = (c + (10 - c%10) if (c%10 != 0) else c)
c_a = c%10
d_s = (d + (10 - d%10) if (d%10 != 0) else d)
d_a = d%10
e_s = (e + (10 - e%10) if (e%10 != 0) else e)
e_a = e%10

answer = (a_s + b_s + c_s + d_s + e_s)

List =[]
List.append(a_a)
List.append(b_a)
List.append(c_a)
List.append(d_a)
List.append(e_a)
List.sort()

for i in range(5):
    if(List[i] != 0):
        answer = answer - (10-List[i])
        break

print(answer)

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

l=[]
l.append([a,a%10])
l.append([b,b%10])
l.append([c,c%10])
l.append([d,d%10])
l.append([e,e%10])
for i in range(5):
  if l[i][1] == 0:
    l[i].append(l[i][0])
  else:
    l[i].append(l[i][0] + (10 - l[i][1]))
    
l.sort(key=lambda x:x[2] - x[0])
s = 0
for i in range(5):
  if i == 4 or l[i][1] == 0: s += l[i][0]
  else: s += l[i][0]+(10 - l[i][0]%10)
print(s)

Solution (Python):
A,B,C,D,E = [int(input()) for _ in range(5)]
a = (10-A) % 10
b = (10-B) % 10
c = (10-C) % 10
d = (10-D) % 10
e = (10-E) % 10
if a == b == c == d == e == 0:
  print(A+B+C+D+E)
else:
  print(A+B+C+D+E+a+b+c+d+e-max(a,b,c,d,e))

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

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

sum = 0
minmo = 10
for i in range(5):
    mo = a[i] % 10
    if mo != 0:
        sum += a[i]+10-mo
        if mo < minmo:
            minmo = mo
    else:
        sum += a[i]

print(sum-10+minmo)

Solution (Python):
import math
inp = [int(input()) for _ in range(5)]
answer = sum([math.ceil(ent / 10) * 10 for ent in inp])
gaps = [ent % 10 for ent in inp if ent % 10 > 0]
if len(gaps):
	answer = answer - 10 + min(gaps)
print(answer)

Solution (Python):
A = [int(input()) for i in range(5)]
A.sort()
dec = 10
dsum = 0
f = 0
for i in A:
    if i % 10 >= 1:
        dec = min(dec,i % 10)
        f = 1
    if not i % 10 == 0:
        dsum = dsum + (i - (i % 10) + 10)
    else:
        dsum = dsum + i
print(dsum+dec-10 if f == 1 else dsum)

Solution (Python):
import math

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

A_ceil = math.ceil(A/10)*10
B_ceil = math.ceil(B/10)*10
C_ceil = math.ceil(C/10)*10
D_ceil = math.ceil(D/10)*10
E_ceil = math.ceil(E/10)*10

f = max([A_ceil-A, B_ceil-B, C_ceil-C, D_ceil-D, E_ceil-E])

print(A_ceil+B_ceil+C_ceil+D_ceil+E_ceil-f)

Solution (Python):
times = [int(input()) for i in range(5)]
diff = [i % 10 for i in times if i % 10 != 0]
diff += [10]
ordertime = [((i + 9) // 10) for i in times]
print(sum(ordertime) * 10 + (-10 + min(diff)))

Solution (Python):
lis = [int(input()) for i in range(5)]
rep = [i - i % 10 + 10 if i % 10 != 0 else i for i in lis]
diff = [(r - l) for l, r in zip(lis, rep)]
print(sum(rep) - max(diff))

Solution (Python):
item = []

for i in range(5):
    item += [str(input())]

i = [
    item[0][len(item[0]) - 1],
    item[1][len(item[1]) - 1],
    item[2][len(item[2]) - 1],
    item[3][len(item[3]) - 1],
    item[4][len(item[4]) - 1]
]
i_replace = [int(a) if int(a) > 0 else 10 for a in i]

min_item = min(i_replace)
last_item = item[int(i_replace.index(min_item))]
item.pop(int(i_replace.index(min_item)))

rep = []
for ii in item:
    if int(ii[len(ii) - 1]) == 0:
        t = int(ii)
    else:
        s = 10 - int(ii[len(ii) - 1])
        t = int(ii) + s

    rep += [t]

rep += [int(last_item)]


print(sum(rep))

Solution (Python):
xs = [int(input()) for i in range(5)]
ps = []
for x in xs:
	ps.append(((x-1)%10+1, x))
ps.sort()
ans = 0
ans += ps[0][1]
for i in range(1, 5):
	ans += (ps[i][1] + 9) // 10 * 10
print(ans)

Solution (Python):
import math
minutes = []
for _ in range(5):
    minutes.append(int(input()))
minutes.sort(reverse = True, key = lambda x: x % 10 if x % 10 != 0 else 10)
x = 0
for minute in minutes:
    x = math.ceil(x / 10) * 10
    x += minute
print(x)

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

li2 = [];ans = 0
for i in li:
    if i%10 == 0:
        ans += i
    else:
        ans += i + (10-i%10)
        li2.append(i%10)
if li2 != []:
    ans -= 10-min(li2)

print(ans)

Solution (Python):
diff = list()
ans = 0
for i in range(5):
  x = int(input())
  ans += x if x %10 == 0 else x + 10 - (x % 10)
  diff.append(0 if x %10 == 0 else 10 - (x % 10))
diff = sorted(diff, reverse = True)
ans -= diff[0]
print(ans)

Solution (Python):
def f(x):
	if x!=0:
		return 10-x
	else:
		return x
def g(x):
	if x%10==0:
		return 10
	else:
		return x%10
a=[]
for i in range(5):
	a.append(int(input()))
b=[]
for i in range(5):
	b.append((g(a[i]),i))
c=[]
for i in range(5):
	c.append(f(b[i][0])+a[i])
b.sort()
t=b[0][1]
ans=0
for i in range(5):
	if i !=t:
		ans+=c[i]
ans+=a[t]
print(ans)

Solution (Python):
a = [int(input()) for _ in range(5)]
a = sorted(a, key=lambda x: -x % 10)
print(sum(x + (-x % 10) for x in a[:-1]) + a[-1])

Solution (Python):
sum = 0
mind = 10
for i in range(5):
    A = int(input())
    d = A%10
    sum += A-d
    if d != 0:
        sum += 10
        mind = min(mind, d)

print(sum - 10 + mind)

Solution (Python):
A,B,C,D,E=int(input()),int(input()),int(input()),int(input()),int(input())
orders = {'A': A, 'B': B, 'C': C, 'D': D, 'E': E}
orders = sorted(orders.items(), key=lambda item: (10 if item[1] % 10 == 0 else item[1] % 10), reverse=True)
res = 0
while orders:
  if res % 10 != 0:
    res += (10 - res % 10)
  order = orders.pop(0)
  res += order[1]
print(res)

Solution (Python):
import itertools

a = [int(input()) for _ in range(5)]
ans = 130*5
for i in itertools.permutations(range(5)):
    tmp = 0
    for j in i:
        if a[i[j]]%10 == 0:
            tmp += a[i[j]]
        else:
            tmp += (a[i[j]] + (10 - a[i[j]]%10))
    if a[i[4]]%10 != 0:
        tmp -= (10 - a[i[4]]%10)
    if ans > tmp:
        ans = tmp

print("{}".format(ans))

Solution (Python):
def main() -> None:
    num = [int(input()) for _ in range(5)]
    ans = 0
    m = [0]
    for i in num:
        if i % 10:
            ans += i + 10 - i % 10
            m.append(10 - i % 10)
        else:
            ans += i
    print(ans - max(m))


if __name__ == '__main__':
    main()

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

extra = [0]*5

for i in range(5):
	extra[i] = (0 if time[i] % 10 == 0 else 10 - (time[i] % 10) )

ex = sum(extra) - max(extra) 
print(sum(time) + ex)

Solution (Python):
order = [int(input()) for i in range(5)]
diff = (sorted(map(lambda x: (x % 10), order)))
diff = [i for i in diff if i != 0]

sum_order = sum(list(map(lambda x: -(-x //10), order))) * 10

if diff != []:
    sum_order += (-10 + diff[0])
    
print (sum_order)

Solution (Python):
import math
l = []
ans = 0
for i in range(5):
    x = int(input())
    l.append(x)
for i in range(1,10):
    f = False
    for j in l:
        if j % 10 == i:
            ans += j
            l.remove(j)
            f = True
            break
    if f: break
for x in l:
    ans += math.ceil(x/10) * 10
print(ans)

Solution (Python):


arr=[int(input()),int(input()),int(input()),int(input()),int(input())]
min=99
min_index=-1
for i,t in enumerate(arr):
    t_mod10 = t % 10
    if t_mod10 != 0 and t_mod10 < min:
        min = t_mod10
        min_index = i

sum = 0
for i,t in enumerate(arr):
    if i == min_index:
        sum += t
    else:
        sum += (t + 9) // 10 * 10

print(sum)

Solution (Python):
import itertools

def calc_time(dishes):
    time_sum = 0
    for t in dishes[:len(dishes) - 1]:
        time_sum += ((t - 1) // 10) * 10 + 10
    time_sum += dishes[-1]

    return time_sum

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

dishes_list = [A, B, C, D, E]

min_time = 10000
for dishes in itertools.permutations(dishes_list):
    if min_time > calc_time(dishes):
        min_time = calc_time(dishes)

print(min_time)

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

ans = 0
b = []
for aa in a:
    if aa%10 == 0:
        ans += aa
    else:
        b.append((aa, aa%10))
if len(b) > 0:
    b = sorted(b, key = lambda x: x[1], reverse = True)
    ans += sum([10*(bb//10+1) for bb, _ in b[:-1]])
    ans += b[-1][0]
print(ans)

Solution (Python):



def my_round(val):
    if val % 10 == 0:
        return val
    else:
        return val + (10 - val % 10)


def main():
    alpha = [int(input()) for _ in range(5)]
    ans = [0 for _ in range(5)]

    for i in range(5):
        for j, a in enumerate(alpha):
            if i == j:
                ans[i] += a
            else:
                ans[i] += my_round(a)

    print(min(ans))


if __name__ == '__main__':
    main()

Solution (Python):
A = [int(input()) for _ in range(5)]
A.sort(key=lambda x: x%10 if x%10!=0 else x)



ans = A[0]
for i in range(1,5):
    ans += ( (A[i] +9  )// 10 * 10)
print(ans)

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

a.sort(key=lambda x:(x-1)%10)

b=0
for i in range(5):
  if i==0:
    b+=a[i]
  else:
    c=(a[i]-1)//10+1
    b+=c*10
print(b)

Solution (Python):
n = 5;
a = [int(input()) for i in range(n)];
last = 9;
time = 0;
flag = True;

for i in a:
	if last % 10  >= i % 10 >= 1:
		time += last  // 10 * 10 + 10;
		last = i;
		flag = False;

	elif i % 10 == 0:
		time += i;

 	else:
		time += i  // 10 * 10 + 10;

if flag:
	print(time + last - 9);

else:	
	print(time + last - 10);

Solution (Python):
list1 = []
list2 = []

time = 0
for n in range(5):

    list1.append(int(input()))

for n in list1:
    q = n // 10
    mod = n % 10
    time += 10 * q
    if mod != 0:
        time += 10
        list2.append(mod)


if list2 != []:
    time = time - 10 + min(list2)
    print int(time)
else:
    print int(time)

Solution (Python):
*a,=map(int,open(0));print(min(~-i%10for i in a)-sum(-i//10*10for i in a)-9)

Solution (Python):
result = 0
min = 10
for i in range(5):
    time = int(input())
    result = result+time if time%10 == 0 else result + time + 10-(time%10)
    if time % 10 < min and time % 10 !=0:
        min = time % 10
print(result - (10-min))

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

def po(x):
  p=x
  while p>10:
    p=p-10
  return p

k=[po(a),po(b),po(c),po(d),po(e)]
f=min(k)


s=a+b+c+d+e+40-po(a)-po(b)-po(c)-po(d)-po(e)+f

print(s)

Solution (Python):
list = []
keta = []
keta2 = []

for i in range(5) : 
    list.append(int(input()))
    
for i in range(5) : 
    a = str(list[i])
    keta.append(int(a[-1]))
    
    

for i in keta : 
    if i == 0 : keta2.append(int("10"))
    else : keta2.append(i)

    





sum = list.pop(keta2.index(min(keta2)))

num = 0

def ten(sel) : 
    global num
    if int(str(sel)[-1]) == 0 : num = sel
    else : 
        ten(sel+1)


for i in list : 
    if i == 0 : sum += i
    else : 
        ten(i)
        sum += num
        
print(sum)

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

dishes = [A, B, C, D, E]

dishes_time = [10 * (i // 10) +  10 if i % 10 != 0 else 10 * (i // 10) for i in dishes]

sum_time = sum(dishes_time)

FinishTime = 0x100000

for i in range(5):
    prov_time = sum_time - dishes_time[i] + dishes[i]
    if sum_time - dishes_time[i] + dishes[i] < FinishTime:
        FinishTime = prov_time

print(FinishTime)

Solution (Python):
import math

dish = [ int(input()) for i in range(5) ]
sum = sum([ math.ceil(d/10)*10 for d in dish])
mdish = 10

for d in dish:
    if d%10 != 0:
        mdish = min(d%10, mdish)

print(sum + mdish - 10)

Solution (Python):
 
import itertools




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


N = []

for i in list(itertools.permutations(range(5))):
    c = 0
    n = 0

    for j in i:
        c += 1
 
        if c == 5:
            n += num[j]

        else:
            if num[j]%10 == 0: n+=num[j]
            else:n += num[j] - (num[j] % 10) + 10
 
    N.append(n)

print(int(min(N)))

Solution (Python):
time = [int(input()) for i in range(5)]
ten_time = 0
smallest_mod = 10
for i in range(5):
    div,mod = divmod(time[i],10)
    if 0 < mod < smallest_mod:
        smallest_mod = mod
    if mod != 0:
        ten_time += div + 1
    else:ten_time += div
print(ten_time * 10 - 10 + smallest_mod)

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

last_order_candidate_value = _list[0]
minimum_mod_10 = 9
for i in range(len(_list)):
    minutes_mod_10 = _list[i] % 10
    if minutes_mod_10 != 0 and minimum_mod_10 > minutes_mod_10:
        minimum_mod_10 = minutes_mod_10
        last_order_candidate_value = _list[i]

_list.remove(last_order_candidate_value)

elaps = 0
for i in range(len(_list)):
    elaps = elaps + _list[i]
    if (elaps%10 != 0):
        elaps = elaps + (10 - elaps%10)
elaps = elaps + last_order_candidate_value

print(elaps)

Solution (Python):
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True 
def ddprint(x):
  if DBG:
    print(x)

a = inn()
b = inn()
c = inn()
d = inn()
e = inn()
t  = [a,b,c,d,e]
p = [ x//10 for x in t ]
r = [ x%10 for x in t ]
if max(r) == 0:
    rest = 0
else:
    rnz = [ x for x in r if x != 0 ]
    rmn = min(rnz)
    rest = 10 * (len(rnz)-1) + rmn

print(10*sum(p) + rest)

Solution (Python):
import numpy as np
v = []
for i in range(5):
    v.append(int(input()))

v = np.array(v)

s = [(i-1)%10 for i in v]

v = v[np.argsort(s)][::-1]

res = v[-1]
for i in range(len(v)-1):
    res += ((v[i]+9) // 10 * 10)

print(res)

Solution (Python):
a2, b, c, d, e= [int(input()) for i in range(5)]
a=[a2,b,c,d,e]
sum = 0;
res = 0; 
temp = 0;
num = 0;
for i in range(5):
  if(a[i]%10==0):
    sum+=a[i]
  else:
    temp = (int(a[i]/10) +1)*10-a[i];
    
    if temp>res:
      sum = sum + res 
      res =temp
      sum+=a[i]
     
    else:
      sum = sum+a[i]+temp
      
print(int(sum))

Solution (Python):
list1=[int(input()) for i in range(5)]
d=0
t=0
for n in list1:
  m=((n-1)//10+1)*10
  t=t+m
  if m-n>d:
    d=m-n
  else:
    d=d
print(t-d)

Solution (Python):
import math

a = [int(input()) for i in range(5)]
b = [x%10 if x%10!=0 else 10 for x in a]
c = [math.ceil(x/10)*10 for x in a]
d = 10 if any(b) else 0
print(sum(c)-d+min(b))

Solution (Python):
import math

Five_Dishes1 = []
Five_Dishes2 = []
for i in range(5):
    time = input()
    time_last = time[-1]
    Five_Dishes1.append(time)
    Five_Dishes2.append(time_last)
    
Five_Dishes_int = [int(n) for n in Five_Dishes1]
Five_Dishes2 = [x if x is not '0' else 'a' for x in Five_Dishes2]
Five_Dishes_last2 = sorted(Five_Dishes2)

last_dish = Five_Dishes2.index(min(Five_Dishes2))
res_time = 0
n = 0
while n < 5:
    if Five_Dishes_int[n] % 10 == 0:
        res_time += Five_Dishes_int[n]
    elif Five_Dishes_int[n] % 10 != 0 and n == last_dish:
        res_time += Five_Dishes_int[n]
    else:
        res_time += math.ceil(Five_Dishes_int[n] / 10 ) * 10    
    n += 1    
        
print(res_time)

Solution (Python):
menu = []
for i in range(0, 5):
	menu.append(int(raw_input()))

queue = [[0, menu]]
min = 1000
while queue != []:
	now = queue.pop(0)
	if now[1] == []:
		if now[0] < min: min = now[0]
	else:
		for i in range(0, len(now[1])):
			newmenu = []
			for j in range(0, len(now[1])):
				if i != j: newmenu.append(now[1][j])
			t = now[0]
			if t % 10 != 0:
				t = (t / 10 + 1) * 10
			t += now[1][i]
			queue.append([t, newmenu])

print min

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter

def j(q):
    if q==1: print("Yay!")
    else:print(":(")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])






a=[ip() for i in range(5)]    



ms = [a[i]%10 for i in range(5)]
for i in range(5):
    if ms[i]==0:ms[i]+=10
p = ms.index(min(ms))
b = []
for i in range(5):
    if i==p:
        b.append(a[i])
    elif a[i]%10:
        b.append(a[i]//10*10+10)
    else: b.append(a[i])
print(sum(b))

Solution (Python):
a=[]
for i in range(5):
  a.append(int(input()))
a.sort(key=lambda x:(x-1)%10)
b=0
for i in range(5):
  if i==0:
    b+=a[i]
  else:
    c=(a[i]-1)//10+1
    b+=c*10
print(b)

Solution (Python):
import sys
import math

matlist = [0] * 5
for i in range(5):
    matlist[i] = int(sys.stdin.readline())

mn = 11
idx = 0
for i in range(5):
    tmp = matlist[i] % 10
    if tmp == 0:
        tmp = 10
    if mn > tmp:
        idx = i
        mn = tmp

ans = 0
for i in range(5):
    if i != idx:
        ans += math.ceil(matlist[i]/10)*10
    else:
        ans += matlist[i]

print(int(ans))

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

menu = [a,b,c,d,e]
mlt = [0]*5
mod = [0]*5
for i in range(5):
    mlt[i] = menu[i] // 10
    mod[i] = menu[i] % 10
    if mod[i] == 0:
        mod[i] = 10

ans = 0
t = 0
for i in range(5):
    if mod[i] == min(mod) and t == 0:
        t = 1
        ans += menu[i]
    elif mod[i] == 10:
        ans += mlt[i]*10
    else:
        ans += (mlt[i]+1)*10


print(ans)

Solution (Python):
import itertools
list = [int(input()) for _ in range(5)]
temp = 0
ans = 10**9

for v in itertools.permutations(list):
    temp = 0
    for i,j in enumerate(v):
        if i != 4:
            if j % 10 == 0:
                temp += j
            else:
                temp += (j//10+1)*10
        else:
            temp += j
    ans = min(ans,temp)

print(ans)

Solution (Python):
import sys
List = [int(input()) for i in range(5)]
s = 0
flag = True
for i in range(1, 10):
    if flag:
        for j in range(5):
            if List[j] % 10 == i:
                s += List.pop(j)
                flag = False
                break

for i in range(len(List)):
    s += (-(-List[i] // 10))*10
print(s)

Solution (Python):

def up(num):
    if num%10 ==0:
        return num
    else:
        return (num//10+1)*10 

arr = []
mod = []

for i in range(5):
    arr.append(int(input()))
    m = 10 if arr[i]%10==0 else  arr[i]%10
    mod.append(m)

index = mod.index(min(mod))
last = arr.pop(index)
sum = sum(map(up,arr))+last
print(sum)

Solution (Python):
a = list(map(int,[input() for i in range(5)]))
b = 10
c = 0
for i in a:
	if i % 10 > 0:
		c += i + 10 - i % 10
		if b > i % 10:
			b = i % 10
	else:
		c += i
print(c-10+b)

Solution (Python):
import math


res = 0
d_min = 10
for i in range(5):
    dish = int(input())
    if dish % 10 == 0:
        res += dish
    else:
        res += math.ceil(dish / 10) * 10
        if dish % 10 < d_min:
            d_min = dish % 10
res -= 10 - d_min
print(res)

Solution (Python):
A=[int(input()) for i in range(5)]
B=[10 if A[i]%10==0 else A[i]%10 for i in range(5)]
k=B.index(min(B))
C=[(A[i]-0.001)//10*10+10 for i in range(5)]
print(int(sum(C)-C[k]+A[k]))

Solution (Python):


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


list = [A, B, C, D, E]


list10 = map(lambda x: -(-x // 10), list)

list20 = map(lambda x: x * 10, list10)

list30 = [x - y for (x, y) in zip(list20, list)]


lmaxindex = list30.index(max(list30))

max = list[lmaxindex]



list.pop(lmaxindex)

list2 = map(lambda x: -(-x // 10), list)
list3 = map(lambda x: x * 10, list2)
list3.append(max)

print(sum(list3))

Solution (Python):
import numpy as np

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


def get_last_dish_index(order_list):
    """
    process: 10で割ったときの剰りが最も小さい要素のindexを求める
             (ただし、剰りが0の場合を除く)
    ===========
    input: int[]
    output: int
    """
    rem_list = list()
    for order in order_list:
        if order % 10 == 0:
            rem_list.append(0)
        else:
            rem_list.append(10 - order % 10)
    
    last_dish_index = rem_list.index(max(rem_list))
    return last_dish_index

order_list = [a, b, c, d, e]
ldi = get_last_dish_index(order_list)
last_order = order_list.pop(ldi)

time = 0
for order in order_list:
    if order % 10 == 0:
        time += order
    else:
        time += order + (10 - order % 10)

print(time+last_order)

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

queue = [(i,) for i in range(5)]
mintime = 1000
while(len(queue)):
    q = queue.pop(0)
    if(len(q)==5):
        time = 0
        for i in q:
            if(time%10 == 0):
                time += times[i]
            else:
                time += 10 - time%10 + times[i]
        mintime = min(mintime, time)
    for i in range(5):
        if not i in q:
            queue.append(q + (i,))

print(mintime)

Solution (Python):
a=[]
b=[]
for i in range(5):
    a.append(int(input()))
ans=sum(a)
for i in range(5):
    losstime =a[i]%10
    if losstime!=0:
        b.append(10-losstime)
if len(b)==0:
    print(sum(a))
else :
    print(sum(a)+sum(b)-max(b))