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 itertools

foods = [int(input()) for _ in range(5)]
all_route = list(itertools.permutations(foods))
ans = []
for route in all_route:
    total = 0

    for i in range(len(route) - 1):
        total += route[i]
        if route[i] % 10 != 0:
            total += 10 - route[i] % 10
    total += route[-1]
    ans.append(total)
print(min(ans))

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

s = []
for i in range(5):
    s.append(t[i] % 10)

o = 5
p = 10
for i in range(5):
    if s[i] > 0:
        if p > s[i]:
            o = i
            p = s[i]

m = 0
for i in range(5):
    if i != o:
        if s[i] == 0:
            m += t[i]
        else:
            m += t[i] - t[i] % 10 + 10

if o != 5:
    m += t[o]
print(m)

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

new_list = []
for i in range(5):
    time = time_list[i]
    amari = 10 - int(str(time_list[i])[-1])
    if amari == 10:
        amari = 0
    new_list.append((time, amari))

new_list = sorted(new_list, key=lambda x: x[1])

total = 0
for i in range(4):
    total += new_list[i][0]
    total += new_list[i][1]

total += new_list[4][0]
print(total)

Solution (Python):
def order(x):
    return (x + 9) // 10 * 10

def wait(x):
    return order(x) - x

dishes = [int(input()) for _ in range(5)]
total = sum(order(i) for i in dishes)
total -= max(wait(i) for i in dishes)
print(total)

Solution (Python):
from itertools import permutations
dishes = [int(input()) for _ in range(5)]
res = 10 ** 3
for di in permutations(dishes):
    tmp = 0
    for d in di:
        if tmp % 10 != 0:
            tmp += (10 - tmp % 10)
        tmp += d
    res = min(res, tmp)
print(res)

Solution (Python):









import sys
import math
from operator import itemgetter
input = sys.stdin.readline

list_time = [int(input()) for i in range(5)]
list_CeilMati = [[0, 0] for i in range(5)]

temp = 0.0
for i in range(5):
    temp = list_time[i]/10
    list_CeilMati[i][0] = math.ceil(temp) * 10
    list_CeilMati[i][1] = list_CeilMati[i][0] - list_time[i]


list_CeilMati.sort(key=lambda x: x[1])


ans = 0
for i in range(5):
    ans += list_CeilMati[i][0]
ans -= list_CeilMati[5-1][1]

print(ans)

Solution (Python):
l = []
for i in range(5): l.append(int(input()))
ok = False
for i in range(5):
    if l[i] % 10 != 0: ok = True
if ok == 0:
    print(sum(l))
    exit()
mini = 9
for i in range(5):
    if l[i] % 10 != 0 and l[i] % 10 < mini % 10:
        mini = l[i]
ans = mini
for i in range(5):
    d = l[i] // 10
    if l[i] % 10 != 0: d += 1
    ans += d * 10
d = mini // 10
d += 1
ans -= d * 10
print(ans)

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

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

re1=A-a
re2=B-b
re3=C-c
re4=D-d
re5=E-e
result=[[re1,A],[re2,B],[re3,C],[re4,D],[re5,E]]
result.sort()
ans=0
for i in range(5):
    if i==4:
        ans+=result[i][1]-result[i][0]
        break
    ans+=result[i][1]
print(ans)

Solution (Python):
from math import ceil
lst = []
ten = []
for i in range(5):
  t = int(input())
  if t % 10 == 0:
    ten.append(t)
  else:
    lst.append(t)
if lst == []:
  print(sum(ten))
  exit()
x = min(lst, key=lambda x: x % 10)
lst.remove(x)
for i in range(len(lst)):
  lst[i] = 10 * (lst[i] // 10 + 1)
print(x + sum(lst) + sum(ten))

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
y = 0
x = [i%10 for i in a]
if max(x) > 0:
    y = 10 - min(filter(lambda i:i!= 0, x))
b = [(i+9) // 10 *10 for i in a]
print(sum(b) - y)

Solution (Python):
import math

li=[int(input()) for _ in range(5)]
m,last,ans,lm=10,li[0],0,0

for i in range(5):
  l = li[i]
  if 0 < l % 10 < m :
    m = l % 10
    last = l
    lm = i

for i in range(5):
  l=li[i]
  if l == last and i == lm:
    ans += l
  else:
    ans += math.ceil(l/10)*10
    
print(ans)

Solution (Python):
def INT():
    return int(input())

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

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

ABCDE = [[INT()] for i in range(5)]

for i in range(5):
    if ABCDE[i][0] % 10 == 0:
        ABCDE[i].append(ABCDE[i][0])
        ABCDE[i].append(0)
        
    else:
        wait = ((ABCDE[i][0] // 10) + 1) * 10
        ABCDE[i].append(wait)
        ABCDE[i].append(wait - ABCDE[i][0])

ABCDE.sort(key = lambda x : x[2])

ans = ABCDE[4][0]

for i in range(4):
    ans += ABCDE[i][1]
    
print(ans)

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

rem = float("inf")
last = 0
for time in times:
    if time % 10 < rem and time % 10 != 0:
        rem = time % 10
        last = time
if last:
    times.remove(last)

total_time = 0
for time in times:
    if time % 10 == 0:
        total_time += time
    else:
        total_time += time + (10 - time % 10)
total_time += last

print(total_time)

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

total_time = 0
while times:
    if len(times) != 1:
        for i in range(len(times)):
            if times[i] % 10 == 0:
                total_time += times[i]
                times.remove(times[i])
                break
        else:
            rem = 0
            re_time = 0
            for time in times:
                if time % 10 > rem:
                    rem = time % 10
                    re_time = time
            total_time += re_time + (10 - rem)
            times.remove(re_time)
    else:
        total_time += times.pop()
        
print(total_time)

Solution (Python):
l=[int(input()) for i in range(5)]
s=[]
for i in range(5):
    s.append((((l[i]//10)+1)*10-l[i])%10)
print(sum(l)+sum(s)-max(s))

Solution (Python):
def t(n):
  if n%10==0:
    return n
  else:
    return ((n//10)+1)*10
def k(n):
  if n%10==0:
    return 0
  else:
    return 10-(n%10)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
L=[k(a),k(b),k(c),k(d),k(e)]
print(t(a)+t(b)+t(c)+t(d)+t(e)-max(L))

Solution (Python):
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()

a=[]
r=[]
for i in range(5):
  s=ii()
  a.append(s)
  r_=s%10
  if r_==0:
    r_=10
  r.append(r_)
  
ans=0
while len(r)>1:
  k=r.index(max(r))
  remain=r.pop(k)
  A=a.pop(k)
  
  ans+=A-remain+10
  
print(ans+a[0])

Solution (Python):
import itertools

A = [int(input())for i in range(0,5,1)]

ans = 10**10
for Atmp in list(itertools.permutations(A)):
    time = 0
    for i in range(0,5,1):
        if time%10 != 0:
            time += (10-time%10)
        time += Atmp[i]
    ans = min(ans,time)
print(ans)

Solution (Python):
import math
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A%10
b=B%10
c=C%10
d=D%10
e=E%10
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
abcde=[a,b,c,d,e]
small=min(abcde)
abcde.sort()
while (small==0) & (len(abcde)!=0):
    try:
        del abcde[0]
        small=abcde[0]
    except:
        pass
if len(abcde)==0:
    small=10
print(A+B+C+D+E-(10-small))

Solution (Python):
List=[int(input()) for i in range(5)]
num=[10,20,30,40,50,60,70,80,90,100,110,120,130]
time=0
table=[]
for i in range(5):
    subtract=0
    for j in range(len(num)):
        if List[i]<=num[j]: 
            subtract=num[j]
            break
    table.append([subtract-List[i],List[i]])
table.sort()
for i in range(5):
    time+=table[i][0]+table[i][1]
time-=table[4][0]
print(time)

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

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

Solution (Python):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a2 = (math.ceil(a / 10)) * 10
b2 = (math.ceil(b / 10)) * 10
c2 = (math.ceil(c / 10)) * 10
d2 = (math.ceil(d / 10)) * 10
e2 = (math.ceil(e / 10)) * 10
ls = [0 for i in range(5)]
ls[0] = a + b2 + c2 + d2 + e2
ls[1] = a2 + b + c2 + d2 + e2
ls[2] = a2 + b2 + c + d2 + e2
ls[3] = a2 + b2 + c2 + d + e2
ls[4] = a2 + b2 + c2 + d2 + e
print(min(ls))

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

ans = 0
min_div = 10
for i in l:
  ans += 10 * ((i + 10 - 1) //10)
  if i % 10 != 0:
  	min_div = min(min_div, i % 10)
print(ans - (10 - min_div))

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

zako=9
switch=0
for i in range(5):
    b=a[i]%10
    if b<=zako and b!=0:
        zako=b
        memory=i
        switch=1

if switch==0:
    memory=1
x=a.pop(memory)

lst=[]

for i in range(4):
    c=a[i]//10
    c=c*10
    if a[i]%10!=0:
        c+=10
    lst.append(c)

print(x+sum(lst))

Solution (Python):
A = []
m = 0
ans = 0
for i in range(5):
  a = int(input())
  if a%10 != 0:
    if round(a+5, -1) - a > m:
      m = round(a+5, -1) - a
    ans += round(a+5,-1)
  else:
    ans += a
print(ans-m)

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

lis = [int(input()) for i in range(5)]
total = np.inf
now = 0
for a,b,c,d,e in permutations(lis,5):
    now = ((a-1)//10+1)*10+((b-1)//10+1)*10+((c-1)//10+1)*10+((d-1)//10+1)*10+e
    total = min(total,now)
    
    

print(total)

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = A%10
if a==5 or a==0:
  a = a+0
else:
  a = 10-a
b = B%10
if b==5 or b==0:
  b = b+0
else:
  b = 10-b
c = C%10
if c==5 or c==0:
  c = c+0
else:
  c = 10-c
d = D%10
if d==5 or d==0:
  d = d+0
else:
  d = 10-d
e = E%10
if e==5 or e==0:
  e = e+0
else:
  e = 10-e
remainder = min(a+b+c+d, a+b+c+e, a+b+d+e)
minimalr = min(remainder, a+c+d+e, b+c+d+e)
print(A+B+C+D+E+minimalr)

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

Solution (Python):
import math
a = []
for _ in range(5):
    a.append(int(input()))
ans = 0
b = 0

for i in a:
    ans += math.ceil(i/10)*10
    if i%10 != 0:
        b = max(b, 10-i%10)
print(ans-b)

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

n = 10
cnt = 0

for i in range(len(a)):
	if int(a[i][-1]) < n and int(a[i][-1]) != 0 :
		n = int(a[i][-1])
		cnt = i

for i in range(len(a)):
	if i == cnt:
		a[i] = int(a[i])
	elif int(a[i][-1]) == 0:
		a[i] = int(a[i])
	else:
		a[i] = (int(a[i])//10 + 1)*10

print(sum(a))

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

n = 9
cnt = 0
for i in range(len(a)):
	if int(a[i][-1]) < n and int(a[i][-1]) != 0 :
		n = int(a[i][-1])
		cnt = i
for i in range(len(a)):
	if i == cnt:
		a[i] = int(a[i])
	elif int(a[i][-1]) == 0:
		a[i] = int(a[i])
	else:
		a[i] = (int(a[i])//10 + 1)*10
print(sum(a))

Solution (Python):
D = [int(input()) for t in range(5)]
lag=[]
for i in range(5):
	lag.append(int(round(D[i]+4.1,-1))-D[i])
lag.pop(lag.index(max(lag)))
print(sum(D)+sum(lag))

Solution (Python):
def KiriageTime(x):
  return (x+9)//10*10

def sabun(x):
  return KiriageTime(x)-x

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
KiriageTotal=KiriageTime(A)+KiriageTime(B)+KiriageTime(C)+KiriageTime(D)+KiriageTime(E)
print(KiriageTotal-max(sabun(A),sabun(B),sabun(C),sabun(D),sabun(E)))

Solution (Python):
import math
 
S = []
L = []
for i in range(5):
    D = int(input())
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)
    
print(int((sum(S) - max(L))*10))

Solution (Python):
from math import ceil
time=[int(input()) for i in range(5)]
amari=[]
ans=0
for i in time:
    if i%10!=0:
        amari.append([i%10,ceil(i/10),i])

    else:
        amari.append([114514,ceil(i/10),i])
amari.sort()
amari.reverse()
for i in range(len(amari)):
    ans+=amari[i][1]*10
ans-=amari[-1][1]*10
ans+=amari[-1][2]
print(ans)

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

a2 = (a+9)//10 * 10
b2 = (b+9)//10 * 10
c2 = (c+9)//10 * 10
d2 = (d+9)//10 * 10
e2 = (e+9)//10 * 10

sum = a2+b2+c2+d2+e2
ans = 1e18
ans = min(ans, sum-a2+a)
ans = min(ans, sum-b2+b)
ans = min(ans, sum-c2+c)
ans = min(ans, sum-d2+d)
ans = min(ans, sum-e2+e)

print(ans)

Solution (Python):
import math

S = []
L = []
for i in range(5):
    D = int(input())
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)

print(int((sum(S) - max(L))*10))

Solution (Python):
def solve():
    d = [int(input()) for _ in range(5)]
    d.sort(reverse=True, key=lambda a: a % 10 if a % 10 > 0 else 9)
    for i in range(4):
        d[i] = -(-d[i]//10) * 10
    print(sum(d))


if __name__ == '__main__':
    solve()

Solution (Python):
ais = map(int, [raw_input() for _ in range(5)] )
ais.sort(key = lambda x:-x % 10)
s = 0
for i in range(4):
  s += (ais[i] + 9)/10 * 10
s += ais[-1]
print s

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
answer = 0
cooking_time_order = sorted([A, B, C, D, E], key=lambda x: 10 - (x % 10))
for _ in range(5):
    if cooking_time_order[-1] % 10 == 0:
        answer += cooking_time_order[-1]
        cooking_time_order.pop()
    else:
        break
if len(cooking_time_order) == 0:
    pass
else:
    for cooking_time in cooking_time_order[:-1]:
        answer += (cooking_time + (10 - (cooking_time % 10)))
    answer += (cooking_time_order[-1])
print(answer)

Solution (Python):
import sys

a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
c = int(sys.stdin.readline())
d = int(sys.stdin.readline())
e = int(sys.stdin.readline())

dishes = [a, b, c, d, e]

min_m = 10
for dish in dishes:
    diff = dish % 10
    if diff > 0:
        min_m = min(min_m, diff)

ans = 0
tmp = -1
for dish in dishes:
    diff = dish % 10
    if min_m != 10 and diff == min_m and tmp == -1:
        tmp = dish
    else:
        if diff:
            ans += dish + 10 - diff
        else:
            ans += dish
tmp = 0 if tmp == -1 else tmp
print(ans + tmp)

Solution (Python):
L = [int(input()) for i in range(5)]
l = []
for i in L:
  if i%10==0:
    l.append(0)
  else:
    l.append(10-i%10)
print(sum(L)+sum(l)-max(l))

Solution (Python):
lis = [int(input()) for _ in range(5)]
lis2 = [i % 10 for i in lis]

x = 0
a = 9
time = 0

for id,val in enumerate(lis2):
    if 0 < val < a:
        x = id
        a = val

for id2, val2 in enumerate(lis):
    if id2 == x:
        continue
    else:
        time += (-(-val2//10)) * 10

print(time+lis[x])

Solution (Python):
d = list(map(int,open(0)))
d.sort(key=lambda x:(x-1)%10, reverse=True)
print(sum((x+9)//10*10 for x in d[:-1]) + d[-1])

Solution (Python):
from math import ceil
a=[int(input()) for i in range(5)]
ans=10
sum=0
for i in a:
  x=(i-1)%10+1
  ans=min(ans,x)
  sum+=ceil(i/10)*10
if ans==10:
  print(sum)
else:
  print(sum+ans-10)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
s=[]
t=[]
x=0
for i in range(5):
    s.append(l[i]%10)
for i in range(5):
    if s[i]==0:
        t.append(l[i])
    else:
        t.append((l[i]//10+1)*10)
        
for i in range(1,10):
    if s.count(i)>0:
        x=10-i
        break
print(sum(t)-x)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines


def main():

    num = []
    for i in range(5):
        num.append(int(readline()))

    k = 99
    ind = -1
    for i in range(5):
        r = num[i] % 10
        if r != 0:
            if r < k:
                k = r
                ind = i

    ans = 0
    for i in range(5):
        if i == ind:
            ans += num[i]
        else:
            ans += 10 * ((num[i] - 1) // 10 + 1)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

*a, = map(int, open(0).read().split())
ans = 0
m = 10
for i in a:
    if i % 10 != 0:
        m = min(m, i % 10)
        ans += i//10*10 + 10
    else:
        ans += i//10*10
print(ans-10+m)

Solution (Python):


import sys
from math import ceil
input=sys.stdin.readline

def main():
    t=[int(input()) for i in range(5)]
    tp10=[t[i]%10 for i in range(5) if t[i]%10!=0]
    ans=0
    for i in range(5):
        ans+=ceil(t[i]/10)*10
    if len(tp10)>0:
      	print(ans-10+min(tp10))
    else:
      	print(ans)
    
if __name__=="__main__":
    main()

Solution (Python):
import numpy as np
A = np.array(list(map(int, open(0).read().split())))

next_time = (np.array(A) + 9) // 10 * 10
 
if A[np.nonzero(A%10)].size > 0:
    print(sum(next_time) - (10 - min(A[np.nonzero(A%10)]%10)))
else:
    print(sum(next_time))

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

import numpy as np

if len([(x%10, i) for i,x in enumerate(A) if x%10!=0]) == 0:
    print(sum(A))
else:
    last_order = A[min([(x%10, i) for i,x in enumerate(A) if x%10!=0])[1]]
    print(sum(A) + sum(10 - np.array([x%10 for x in A if x%10!=0])) - (10 - min([x%10 for x in A if x%10!=0])))

Solution (Python):
def resolve():
    ans = [input() for _ in range(5)]
    an = 0
    count = []
    for i in range(5):
        if ans[i][-1]=="0":
            an += int(ans[i])
        else:
            an += int(ans[i])+10-int(ans[i][-1])
            count.append(int(ans[i][-1]))
    print(an-10+min(count) if len(count) != 0 else an)
resolve()

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

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

Solution (Python):
import itertools
t=[0]*5
for i in range(5): t[i]=int(input())
t=list(itertools.permutations(t))
ans=10**5
for i in t:
    a=0
    for j in i:
        if a!=0: a+=0 if a%10==0 else 10-(a%10)
        a+=j
    ans=min(ans,a)
print(ans)

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

for i in range(5):
    if A[i] % 10 == 0:
        ans += A[i]
    else:
        temp = (A[i]//10)*10 + 10
        ans += temp
        if temp2 > A[i] % 10:
            temp2 = A[i] % 10


temp2 = 10 - temp2
ans = ans - temp2
print(ans)

Solution (Python):






abcde = []
for _ in range(5):
    abcde.append(int(input()))
print(sum(-(-x//10)*10 for x in abcde) + min(x%10 if x%10 != 0 else 10 for x in abcde ) - 10)

Solution (Python):
import itertools

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

l = [a, b, c, d, e]

min_m = 999 * 5
for abcde in itertools.permutations(l, 5):
    
    end = 0
    for v in abcde:
        mod = end % 10
        if mod != 0:
            end += 10 - mod
        end += v
        
    if end < min_m:
        min_m = end
print(min_m)

Solution (Python):
import itertools
import math

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

menu = [a, b, c, d, e]

permutations = list(itertools.permutations(range(5)))

ans = float('inf')
for p in permutations:
    time = 0
    for i in range(5):
        time += menu[p[i]]
        if i != 4:
            time = math.ceil(time / 10) * 10
    ans = min(ans, time)

print(ans)

Solution (Python):
a = [int(input()) for i in range(5)]
max = 0
kazu = 0
ans = 0
for i in range(5):
    if a[i]%10 == 0: amari = 0
    else: amari = 10-(a[i]%10)
    if amari >= max:
        max = amari
        kazu = i
for i in range(5):
    if i == kazu: pass
    else:
        if a[i]%10 == 0:
            ans+=a[i]
        else:
            ans+=((int(a[i]/10))*10 +10)
print(ans+a[kazu])

Solution (Python):
import itertools


def actual(a, b, c, d, e):
    all_permutations = list(itertools.permutations([a, b, c, d, e], 5))

    order_time_list = []

    for orders in all_permutations:
        elapsed_time = 0

        for i in range(5):
            elapsed_time += orders[i]

            if i == 4:
                
                continue

            fraction = elapsed_time % 10

            if fraction != 0:
                
                
                elapsed_time += 10 - fraction

        order_time_list.append(elapsed_time)

    return min(order_time_list)

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

print(actual(a, b, c, d, e))

Solution (Python):

import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

tmp = [a,b,c,d,e]
time = []
for i in range(5):
    if tmp[i] % 10 != 0:
        s = ((tmp[i]) // 10 + 1)*10 - tmp[i]
    else:
        s = 0
    time.append(s)
    
idx = np.argmax(np.array(time))
last = tmp.pop(idx)


result = 0
for j in range(4):
    if tmp[j] % 10 != 0:
        result += (tmp[j] // 10 + 1)* 10
    else:
        result += tmp[j]
        
result += last

print(result)

Solution (Python):
flag = False
mini = 124
time = 0
for _ in range(5):
    A = int(input())
    if A%10 == 0:
        time += A
    else:
        time += A - A%10 + 10
        mini = min(A%10, mini)
        flag = True
if flag:
    time += mini - 10
print(time)

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

b = 0
total = 0
for i in a:
  x = math.ceil(i / 10) * 10
  b = max(b, x - i)
  total += x

print(total - b)

Solution (Python):
lis = []
rank1 = []
for i in range(5):
  lis.append(input())
  rank1.append( 10 if lis[-1][-1] == "0" else int(lis[-1][-1]))

min_index = rank1.index(min(rank1))
  
ans = 0
for i in range(5):
  if i == min_index:
    continue
  ans = (ans + int(lis[i]) + 9)//10*10
ans += int(lis[min_index])

print(ans)

Solution (Python):
def ip():return int(input())
ans=0
m=10
for i in range(5):
    a=ip()
    if a%10>0:
        ans+=(a//10+1)*10
    else:ans+=a
    if a%10>0:m=min(m,a%10)
print(ans-(10-m))

Solution (Python):
import math

lis = []
for _ in range(5):
    lis.append(int(input()))
    
def roundup(x):
    return int(math.ceil(x/10)) * 10
    

    
minind = 9
tmp2 = 0
for i in range(5):
    tmp = str(lis[i])
    if tmp[-1] != "0":
        minind = min(minind, int(tmp[-1]))
        if minind == int(tmp[-1]):
            tmp2 = lis[i]
   
if tmp2 == 0:
    print(sum(lis))
    exit()

lis.remove(tmp2)

for j in range(4):
    lis[j] = roundup(lis[j])
        
print(sum(lis)+tmp2)

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

L = [(10-a%10)%10, (10-b%10)%10, (10-c%10)%10, (10-d%10)%10, (10-e%10)%10]
print(a+b+c+d+e+sum(L)- max(L))

Solution (Python):
a=[]
yojo=[]
sm=0
for i in range(0,5):
  x=int(input())
  if x%10==0:
    x-=10
  a.append(x//10)
  yojo.append(x%10)

yo=[10 if i==0 else i for i in yojo]
out=sum(a)*10+40+min(yo)

print(out)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = math.ceil(a / 10)
x += math.ceil(b / 10)
x += math.ceil(c / 10)
x += math.ceil(d / 10)
x += math.ceil(e / 10)
rems = [r for r in [a%10, b%10, c%10, d%10, e%10] if r != 0]
if len(rems) > 0:
    ans = 10*(x-1) + min(rems)
else:
    ans = 10*x
print(ans)

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

for i in range(5):
    if arr[i]%10!=0:
        brr.append(arr[i]%10)
    else:
        brr.append(arr[i])
ans=brr.index(min(brr))



for i in range(5):
    if i==ans or arr[i]%10==0:
        result+=arr[i]
    else:
        result+=arr[i]+10-arr[i]%10
        
print(result)

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

ans = 0
r =[]
for i in range(5):
  if d[i]%10!=0:
    r.append(d[i]%10)
    ans += d[i]-(d[i]%10)+10
  else:
    ans += d[i]

if len(r) == 0:
  print(ans)
  exit()
else:
  ans -= 10-min(r)
  print(ans)

Solution (Python):
from math import *

def comTime(x):
  return ceil(x/10) * 10

def solve(_l):
  s = 0
  l =sorted(_l, key=lambda x: (10-x) % 10, reverse=True)
  s += sum(map(comTime,l[1:])) + l[0]
  return s
  
_l = [int(input()) for _ in range(5)]
print(solve(_l))

Solution (Python):
import math
from collections import deque
from collections import defaultdict

import bisect


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

time = []
minValue = 10
minIndex = -1
for i in range(5):
	x = readInt()
	time.append(x)
	if int(str(x)[-1])<minValue and int(str(x)[-1]) != 0:
		minValue = int(str(x)[-1])
		minIndex = i

ans = 0

for i in time:
	tar = i-1
	if tar<11:
		x = 10
	else:
		x = int(str(int(str(tar)[:-1])+1)+"0")
	ans+=x

tyo = 10-int(str(time[minIndex])[-1])
if tyo==10:
	tyo=0

print(ans-tyo)

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

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