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):
list = [int(input()) for n in range(5)]
min = 100
min_arg = 0
for i in range(5):
  if min > list[i] % 10 and list[i] % 10 != 0:
    min = list[i] % 10
    min_arg = i
ans = 0
for i in range(5):
  if i == min_arg:
    continue
  ans += list[i]
  if ans % 10 != 0:
    ans = ans - (ans % 10) + 10
ans += list[min_arg]
print(ans)

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

minus = 0
ans = 0

for i in [a,b,c,d,e]:
    shou = i//10
    amari = i% 10
    if amari == 0:
        amari = 10
    minus = max(minus,10-amari)
    ans += (shou+1)*10 if amari != 10 else + shou*10
ans -= minus


print(ans)

Solution (Python):
nums = [int(input()) for i in range(5)]
maxleft = 0
m = -1
for i in range(5):
    temp = 10 - nums[i] % 10
    if temp > maxleft and temp != 10:
        maxleft = temp
        m = i

total = 0
for i in range(5):
    if i != m and nums[i] % 10 != 0:
        total += nums[i] - nums[i] % 10 + 10
    else:
        total += nums[i]
print(total)

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

sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)

x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))

print(sum(sample_list)+sum(x)-max(x))

Solution (Python):
a =int(input())
b =int(input())
c =int(input())
d =int(input())
e =int(input())
sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)
x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))
print(sum(sample_list)+sum(x)-max(x))

Solution (Python):



NUM_DISHES = 5
intervals = list()

total_time = 0
for i in range(NUM_DISHES):
    serve_time = int(input())
    total_time += serve_time

    if serve_time % 10 == 0:
        intervals.append(0)
    else:
        intervals.append(10 - serve_time % 10)

intervals.sort()

for interval in range(len(intervals) - 1):
    total_time += intervals[interval]

print "{:d}".format(total_time)

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

def f(S,v):
    if S:
        res = []
        for i in range(len(S)):
            res += f(S[:i] + S[i+1:], 10 * ceil(v / 10) + S[i])
        return res
    else:
        return [v]
ans = min(f([a,b,c,d,e],0))
print(ans)

Solution (Python):
from functools import reduce
def dishes(a,b,c,d,e):
    s = [a,b,c,d,e]
    k = list(map(lambda x:(int(x/10)+1)*10 if x%10 != 0 else (int(x/10))*10,s))
    x = [k[i] - s[i] for i in range(len(s))]
    i = x.index(max(x))
    k.remove(k[i])
    k.append(s[i])
    ans = reduce(lambda x,y:x + y,k)
    return ans

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(dishes(a,b,c,d,e))

Solution (Python):
a =int(input())
b =int(input())
c =int(input())
d =int(input())
e =int(input())
sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)
x = []
for i in sample_list:
    if i % 10 == 0:
        x.append(0)
    else:
        x.append(10-(i%10))
print(sum(sample_list)+sum(x)-max(x))

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = 0
g = 0
h = 0
i = 0
j = 0
for k in range(9):
    if (a + f) % 10 != 0:
        f += 1
    if (b + g) % 10 != 0:
        g += 1
    if (c + h) % 10 != 0:
        h += 1
    if (d + i) % 10 != 0:
        i += 1
    if (e + j) % 10 != 0:
        j += 1
print(a+b+c+d+e+f+g+h+i+j-max(f,g,h,i,j))

Solution (Python):
import math
a=[input() for i in range(5)]
nzero=['99999']
for i in a:
    if i[-1]!='0':
        nzero+=[i[-1]]
ans=sum([math.ceil(int(i)/10)*10 for i in a])
h=min(nzero)

if h=='99999':
    print(ans)
else:
    print(ans-10+int(h))

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

ans = 0

deff = 0


def define(x):
    return ((x + 9) // 10) * 10 - x


for i in X:
    
    f = (i + 9) // 10
    f *= 10
    XX.append(f)


deff = max(define(int(X[0])), define(int(X[1])), define(int(X[2])), define(int(X[3])), define(int(X[4])))


for i in XX:
    ans += i


print(ans - deff)

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

lsum = sum([int((i-1) // 10) * 10 + 10 for i in l])
lmin = 9 - min([(i-1) % 10 for i in l])

print(lsum - lmin)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
l = [A, B, C, D, E]
d = []
 
for i in l:
    if i % 10 == 0:
        d.append(0)
    else: 
        d.append(10 - (i % 10))
 
print(sum(l) + sum(d) - max(d))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
l = [A, B, C, D, E]
d = []
 
for i in l:
    if i % 10 == 0:
        d.append(0)
    else: 
        d.append(10 - (i % 10))
 
print(sum(l) + sum(d) - max(d))

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

minutes = [A, B, C, D, E]
diff = []

for i in minutes:
    if i % 10 == 0:
        diff.append(0)
    else: diff.append(10 - (i % 10))

print(sum(minutes) + sum(diff) - max(diff))

Solution (Python):
time=0
list1=[int(input()) for i in range(5)]
list2=[]
for i in range(5):
    tmp=0
    for j in range(5):
        if i==j or list1[j]%10==0:
            tmp+=list1[j]
        else:
            tmp+=(list1[j]-list1[j]%10+10)
    list2.append(tmp)
print(min(list2))

Solution (Python):

import numpy as np
line = np.zeros([5,],dtype=np.int)
for i in range(0,5):
    line[i] = int(input())

line_k = line%10


last_one=0
last_one_min=10
for l in range(0,5):
    if (line_k[l]>0):
        if last_one_min>line_k[l]:
            last_one_min=line_k[l]
            last_one=l

count = 0
for j in range(0,5):
    if j==last_one:
        count+=line[j]
    else:
        if line_k[j]==0:
            count+=line[j]
        else:
            count+=10*(line[j]//10) + 10
print(count)

Solution (Python):
L = [int(input()) for i in range(5)]
longmenuindex=0
for i in range(len(L)):
    if(L[i]%10<L[longmenuindex]%10 and L[i]%10!=0):
        longmenuindex = i
time=0
for i in range(len(L)):
    if(i != longmenuindex):
        if(L[i]%10!=0):
            time += (L[i]+(10-L[i]%10))
        else:
            time += L[i]
print(time+L[longmenuindex])

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

L = [x % 10 if x % 10 != 0 else 10 for x in List]
last_item = L.index(min(L))


for i in range(len(List)):
    if (List[i] % 10) and i != last_item:
        List[i] = List[i] + (10 - List[i] % 10)

print(sum(List))

Solution (Python):
abc = int(input())
arc = int(input())
agc = int(input())
apc = int(input())
atc = int(input())

num_list = [abc, arc, agc, apc, atc]

def fn(num):
  if num % 10 == 0:
    return 0
  else:
    return 10 - num % 10

num_list_res = [fn(num) for num in num_list]
max_idx = num_list_res.index(max(num_list_res))

ans = 0
for i in range(len(num_list)):
  if i == max_idx:
    ans += num_list[i]
  else:
    ans += num_list[i] + num_list_res[i]
print(ans)

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

Solution (Python):
from math import ceil 
L=[]
X=0
M=int(input())
L.append(M)
for i in range(4) :
  A=int(input())
  L.append(A)
  if A%10 < M%10 and A%10!=0 :
    M=A
L.remove(M)
for i in L :
  X+=ceil(i/10)*10
print(X+M)

Solution (Python):
t=list(map(int,open(0)))
def divideten(x): 
	if x%10==0:
		return 10
	else: 
		return x%10
u=sorted(map(divideten,t))
def kiriage(x):
	if x%10==0:
		return x
	else:
		return x+10-(x%10)
v=list(map(kiriage,t))
print(sum(v)+min(u)-10)

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

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

list_1 = [A, B, C, D, E]
list_2 = [a, b, c, d, e]
list_2_2 = []
for x in list_2:
    if x != 0:
        list_2_2.append(x)
if list_2_2 != []:
	smallest = min(list_2_2)
else:
  	smallest = 10

list_3 = []

count = 0
for i in range(5):
    if list_2[i] == smallest and count % 10 == 0:
        list_3.append(list_1[i])
    elif list_2[i] != 0:
        list_3.append(list_1[i] - list_2[i] + 10)
    else:
        list_3.append(list_1[i])
    count += list_3[i]

sum = 0
for x in list_3:
    sum += x
    
print(sum)

Solution (Python):



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

e = min(map(lambda x: (x - 1) % 10 + 1, ABCDE))
s = list(map(lambda x: int((x - 1) / 10) * 10 + 10, ABCDE))
print(sum(s) - (10 - e))

Solution (Python):
import math


minutes = [int(input()) for i in range(5)]
m = [math.ceil(minutes[k] / 10) * 10 for k in range(5)]


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


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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [a, b, c, d, e]
u = []
v = []
ans = 0

for i in range(len(s)):
    if s[i] % 10 == 0:
        ans += s[i]
    else:
        u.append(s[i])
        v.append(s[i] % 10)

if len(v) != 0:
    k = min(v)
    for j in range(len(u)):
        ans += u[j] + 10 - v[j]
        
    ans = ans - 10 + k
print(ans)

Solution (Python):


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

for i in range(5):
    amari.append([time_list[i] // 10, time_list[i] % 10])
    
small = 9
number = 0
for i in range(5):
    if amari[i][1] > 0 and amari[i][1] < small:
        small = amari[i][1]
        number = i
        
total_time = 0
for i in range(5):
    if i != number:
        if amari[i][1] == 0:
            total_time += amari[i][0] * 10
        else:
            total_time += amari[i][0] * 10 + 10
    else:
        total_time += time_list[i]
        
print(total_time)

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

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

def calRest(times):
	rest = 10
	for time in times:
		if time % 10 == 0:
			continue
		elif time % 10 < rest:
			rest = time % 10
	return 10 - rest

sumTime = sum([10 * (int((time-1)/10)+1) for time in times])
rest = calRest(times)
neatTime = sumTime - rest
print(neatTime)

Solution (Python):
a=[int(input()) for i in range(5)]
minn,summ=10,0
for i in a:
  minn=min(minn,(i-1)%10)
  summ+=(i+9)//10
print(summ*10+minn-9)

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

def subtime(x):
    return deltime(x)-x

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

sumtime=deltime(a)+deltime(b)+deltime(c)+deltime(d)+deltime(e)
sumtime -= max([subtime(a),subtime(b),subtime(c),subtime(d),subtime(e)])

print(sumtime)

Solution (Python):
import math

nums = []
last_pos = 0
total = 0

def score(n):
    
    if n % 10 == 0:
        return 10
    return n % 10

def ceil(n):
    return math.ceil(n / 10) * 10

for i in range(5):
    t = int(input())
    nums.append(t)
    if score(t) < score(nums[last_pos]):
        last_pos = i

for i in range(5):
    if i == last_pos:
        continue
    total += ceil(nums[i])

total += nums[last_pos]

print(total)

Solution (Python):
def abc(n):
    if n % 10 == 0:
        return n
    else:
        return n + 10 - (n%10)

ans = 0
mods = []

for _ in range(5):
    tmp = int(input())
    ans += abc(tmp)
    mods.append(tmp%10)

if not set(mods) == {0}:
    while 0 in mods:
        mods.remove(0)
    ans -= 10
    ans += min(mods)

print(ans)

Solution (Python):
lists = []
lists2 = []
a = int(input())
if a %10 == 0:
    lists2.append(a)
else:
    lists.append(a)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
time = 0
for t in lists2:
    time += t
for t in lists[0:len(lists)-1]:
    time += (10 - t%10) + t
if len(lists) >= 1:
    time +=lists[-1]
print(time)

Solution (Python):
atoe =[int(input()),int(input()),int(input()),int(input()),int(input())]

maxNum = 5
wrap = 0
atoe = sorted(atoe, key=lambda x: -10 if x%10==0 else -(x%10))
for i in range(0, maxNum-1):
    if atoe[i] % 10 == 0:
        step = atoe[i]
    else:
        step = (atoe[i] // 10 + 1) * 10
    
    wrap += step

wrap += atoe[maxNum-1]
print(wrap)

Solution (Python):
data = [int(input()) for i in range(5)]
data.sort(key = lambda x : x % 10)
data_rev = []
first_10multiple = True
for d in data:
    if d % 10 == 0:
        data_rev.append(d)
    elif first_10multiple == True:
        data_rev.append(d)
        first_10multiple = False
    else:
        data_rev.append(d + 10 - d % 10)
print(sum(data_rev))

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

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

sum = sum(((i-1)//10+1)*10 if j != b.index(min(b)) else i for j,i in enumerate(a))

print(sum)

Solution (Python):




X = []

for _ in range(5):
    X.append(int(input()))  


a = 9
last_i = 0
for i, j in enumerate(X):
    num1 = int(str(j)[-1])

    if 0 < num1 < a:
        a = num1
        last_i = i

res = []
for x, y in enumerate(X):
    if x == last_i or y % 10 == 0:
        res.append(y)
    else:
        m = 10 - int(str(y)[-1])
        
        res.append(y + m)

print(sum(res))

Solution (Python):
import math
dishes = [int(input()) for _ in range(5)]
lead_times = [int(math.ceil(t/10))*10 - t for t in dishes]
max_idx = lead_times.index(max(lead_times))
result = 0
for i in range(5):
  result += dishes[i]
  if i != max_idx:
    result += lead_times[i]
print(result)

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



m = 10
t = 0
for a in L:
    mod = a % 10
    if mod == 0:
        t = t + a
    else:
        t = t + (a // 10 + 1) * 10
        m = min(m, (a % 10))

if m == 10:
    print(t)
else:
    print(t - 10 + m)

Solution (Python):



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


nextTime = list(map(lambda x: (x+9)//10*10, Time))


best = 10**5
sum = 0
for i in range(5):
    for j in range(5):
        if i == j:
            sum = sum + Time[j] 
        else:
            sum = sum + nextTime[j]
    best = min(best, sum)
    sum = 0

print(best)

Solution (Python):
list = [int(input()) for i in range(5)]
ans = 0
amari = []
for i in range(5):
  ans += (list[i] // 10) * 10
  amari.append(list[i] % 10)
amari = sorted(amari)
for i in range(5):
  if amari[i] != 0:
    ans += amari[i]
    ans += (5-(i+1)) * 10
    break
print(ans)

Solution (Python):
b = []
r = []

for _ in range(5):
  a = int(input())
  b.append((a // 10) * 10)
  r.append(a % 10)

ans = sum(b)
r.sort()

x = 10
count = 0
for _, ele in enumerate(r):
  if ele > 0:
    x = ele
    break
  count += 1
  
ans += (x + (4 - count) * 10)

print(ans)

Solution (Python):
s=[int(input()) for _ in range(5)]
k=[s[i]%10 for i in range(5)]
l=[]
for i in range(5):
    if k[i] !=0:
        l.append(10-k[i])
    else:
        l.append(0)
p=max(l)
m=sum(s)
n=sum(l)
print(int(m+n-p))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = int(0.1*(9+A))
b = int(0.1*(9+B))
c = int(0.1*(9+C))
d = int(0.1*(9+D))
e = int(0.1*(9+E))
t_1 = 10*(a+b+c+d) + E
t_2 = 10*(b+c+d+e) + A
t_3 = 10*(c+d+e+a) + B
t_4 = 10*(d+e+a+b) + C
t_5 = 10*(e+a+b+c) + D
print(min([t_1,t_2,t_3,t_4,t_5]))

Solution (Python):
*a,=map(int,open(0));b=[(i+9)//10*10for i in a];s=sum(b)
print(min(s-b[i]+a[i]for i in range(5)))

Solution (Python):
a = int(input(''))
b = int(input(''))
c = int(input(''))
d = int(input(''))
e = int(input(''))
list_i = [a,b,c,d,e]
 
min_n = list_i[0] % 10
v = 0
count = 0
 
for i in range(len(list_i)):
 if list_i[i] % 10 < min_n and list_i[i] % 10 != 0:
  count = i
 
for i in range(len(list_i)):
 if i == count or list_i[i] % 10 == 0:
  v = v + list_i[i]
 else:
  v = v + list_i[i] + ( 10 - list_i[i] % 10)
 
print v

Solution (Python):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = math.ceil(a/10)*10
bb = math.ceil(b/10)*10
cc = math.ceil(c/10)*10
dd = math.ceil(d/10)*10
ee = math.ceil(e/10)*10
lista = [a, bb, cc, dd, ee]
listb = [aa, b, cc, dd, ee]
listc = [aa, bb, c, dd, ee]
listd = [aa, bb, cc, d, ee]
liste = [aa, bb, cc, dd, e]
suma = sum(lista)
sumb = sum(listb)
sumc = sum(listc)
sumd = sum(listd)
sume = sum(liste)
print(min(suma, sumb, sumc, sumd, sume))

Solution (Python):
time = [int(input()) for i in range(5)]
total = 0
min = 10
index = 0

for i in range(5):
    if (min > time[i] % 10 and time[i] % 10 != 0):
        min = time[i] % 10
        index = i
if min < 10:
    max = time[index]
    time.pop(index)

for i in range(len(time)):
    while total % 10 != 0:
        total += 1
    total += time[i]

if min < 10:
    while total % 10 != 0:
        total += 1
    total += max

print(total)

Solution (Python):

import math

price = []

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

kiriage = [10*(math.ceil(i/10)) for i in price]

amari = [i%10 for i in price]


if max(amari) == 0:
    print(sum(kiriage))

else:
    while min(amari) == 0:
        amari.remove(0)

    print(sum(kiriage)-10+ min(amari))

Solution (Python):
a = int(input())
b= int(input())
c = int(input())
d = int(input())
e = int(input())
l = [] 
for i in [a,b,c,d,e]:
    if i % 10 != 0: 
        l.append(i//10*10+10-i)
print(sum([a,b,c,d,e])+sum(sorted(l)[:-1]))

Solution (Python):
from itertools import permutations
def solve(perm):
  t = 0
  for i in perm:
    t = ((t + 9) // 10) * 10
    t += x[i]
  return t

x = [int(input()) for _ in range(5)]
ans = min([solve(perm) for perm in permutations([i for i in range(len(x))])])
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
list=[a,b,c,d,e]
worst=10
flag=0
ans=0
for i in range(5):
  if list[i]%10 != 0:
    if list[i]%10 < worst:
      worst = list[i]%10
      flag=i
for i in range(5):
  if i == flag:
    ans += list[i]
  elif list[i]%10 == 0:
    ans += list[i]
  else:
    ans += (list[i] + 10-list[i]%10)
print(ans)

Solution (Python):
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = ar.index(max(ar))
ar.pop(s)
ans = sum(l) + sum(ar)
print(ans)

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


ar = [t % 10 for t in [a, b, c, d, e] if t % 10 != 0]
if len(ar) == 0:
    ar.append(0)
mi = min(ar)





w = sum([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]])

if mi > 0:
    w = w - 10 + mi
print(w)

Solution (Python):
import numpy as np

X = np.array([int(input()) for i in range(5)])

last = -100
last_idx = -100
for i in range(len(X)):
    if X[i]%10 == 0:
        c = -1
    else:
        c = 10 - X[i]%10

    if c > last:
        last_idx = i
        last = c

X_max = X[last_idx]
X = np.delete(X, last_idx)

ans = 0
for x in X:
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10 + 10
ans += X_max

print(ans)

Solution (Python):
import math
import sys

ts = [int(i) for i in sys.stdin.read().strip().split('\n')]
ds = [int(math.ceil(t / 10) * 10) - t for t in ts]
ans = sum(ts) + sum(ds) - max(ds)
print(ans)

Solution (Python):
def main():
    x = [int(input()) for _ in range(5)]
    print(solve(x))

def solve(x):
    y = sorted(x, key=gap, reverse=True)
    s = sum(ceil(i) for i in y[1:])
    return s + y[0]

def ceil(x):
    r = x % 10
    if r != 0:
        return x + 10 - r
    else:
        return x

def gap(x):
    r = x % 10
    if r != 0:
        return 10 - r
    else:
        return 0

main()

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

import math
Lc = []
L_subtract = []
for i in range(len(L)):
    Lc.append(math.ceil(L[i]/10)*10)
    L_subtract.append(Lc[i]-L[i])
print(sum(Lc) - max(L_subtract))

Solution (Python):


import itertools

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


    

m = 1000000
for nums in itertools.permutations(P):
    
    s = 0
    
    for i, num in enumerate(nums):
        s += num
        if s % 10 != 0 and i != 4:
            s += (10 - s % 10)
    m = min([m, s])

print(m)

Solution (Python):
lst = [0] * 5

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

s = 0
for i in range(5):
  s += (lst[i]+9) // 10 * 10
  
ans = s
for i in range(5):
  if lst[i] % 10:
  	ans = min(ans, s-10+lst[i]%10)
  
print(ans)

Solution (Python):
menu_time=[]
total_time = 0
last_time = 9
for i in range(0,5):
    a = int(input())
    menu_time.append(a)
for i in range(0,5):
    if menu_time[i]%10==0:
        total_time+=menu_time[i]
    else:
        total_time+=(menu_time[i]//10+1)*10
for i in range(0,5):
    if menu_time[i]%10!=0 and menu_time[i]%10<last_time:
        last_time = menu_time[i]%10
    else:
        dum=0
if menu_time[0]%10==menu_time[1]%10==menu_time[2]%10==menu_time[3]%10==menu_time[4]%10==0:
    dum = 0
else:
    total_time+=last_time-10
print(total_time)

Solution (Python):
a = [int(input()) for i in range(5)]
m = 0
n = 0
for i in a:
  if i%10 != 0:
    t = 10 - i%10
  else:
    t = 0
  n += i + t
  m = max(m,t)
print(n-m)

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

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

Solution (Python):
time=[]
back=0
for i in range(5):
    A=int(input())
    if A%10==0:
        pass
    else:
        back=max(back,10-A%10)
        A=(A//10)*10 +10

    time.append(A)

print(sum(time)-back)

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
    
a.sort(reverse=True, key=lambda x: (x-1)%10)

for i in range(4):
    if a[i] %10 != 0:
        a[i] = (a[i]//10 + 1)*10
        
print(sum(a))

Solution (Python):
p=[]
m=[]
ans=0
p.append(int(input()))
p.append(int(input()))
p.append(int(input()))
p.append(int(input()))
p.append(int(input()))

for i in p:
    if i%10==0:
        ans += i
    else:
        ans += (1+i//10)*10


for i in p:
    if i%10 != 0:
        m.append(i%10)

if len(m) >0:
    print(ans - (10-min(m)))
else:
    print(ans)

Solution (Python):
sum =0
min_time =10

for i in range (5):
    x = int(input()) 
    if x%10 > 0 :
        if x%10 < min_time :
            min_time = x%10;
        x = (int(x/10) +1)*10;
        sum = sum+x;
    else:
        sum = sum+x;
print (sum-(10-min_time));

Solution (Python):
origin_time = []
wait_time = []
dead_time = []
for i in range(5):
    origin = int(input())
    origin_time.append(origin)
    wait = int((origin + 9)/10) * 10
    wait_time.append(wait)
    dead = wait - origin
    dead_time.append(dead)

print(str(sum(wait_time)-max(dead_time)))

Solution (Python):
import math

one = [10]
total = 0
for i in range(5):
    time = input()
    if time[-1] != "0":
        one.append(int(time[-1]))
    time = int(time)
    time = math.ceil(time / 10) * 10
    total += time
total += min(one) - 10
print(int(total))

Solution (Python):
import itertools

def f(x):
    if x[1] == 0:
        return x[1]
    else:
        return 10 -x[1] 

a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))


b = []

for i in a:
    c = i - (int(i / 10) * 10) 
    b.append((i, c))

b.sort(key=f)

x = 0

for i in b:
    x += i[0]
    if i[1] != 0:
        x += 10 - i[1]
        l = 10 - i[1]
    else:
        l = 0
x -= l

print(x)

Solution (Python):
times = [int(raw_input()) for i in range(5)]
dists = [(i % 10 or 10) for i in times]
last_index = dists.index(min(dists))
print sum([(time / 10 + (1 if time % 10 else 0)) * 10 for ind, time in enumerate(times) if ind != last_index] + [times[last_index]])

Solution (Python):
times = [int(raw_input()) for i in range(5)]
dists = [(i % 10 or 10) for i in times]
last_index = dists.index(min(dists))
print sum([(time / 10 + (1 if time % 10 else 0)) * 10 for ind, time in enumerate(times) if ind != last_index] + [times[last_index]])

Solution (Python):
import math
import sys

ts = [int(i) for i in sys.stdin.read().split('\n') if i != '']
ds = [int(math.ceil(t / 10) * 10) - t for t in ts]
m = max(ds)
ds.remove(m)
ans = sum(ts) + sum(ds)
print(ans)

Solution (Python):
A=[int(input()) for i in range(5)]
B=[a-a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b-a) for a,b in zip(A,B)]
print(sum(B)-max(diff))

Solution (Python):
lst = []
for i in range(5):
    lst.append(int(input()))
lst.sort(reverse=True, key = lambda x : (x - 1) % 10)
s = 0
for i in range(5):
    s += lst[i]
    if s % 10 != 0 and i != 4:
        s += 10 - s % 10

print(s)

Solution (Python):
ar = []
br = []
cr = []
mn = 10
for i in range(5):
    l = input()
    if int(l) % 10 == 0:
        ar.append(int(l))
    else:
        br.append(int(l))
        if mn > int(l) % 10:
            mn = int(l) % 10
for r in br:
    if str(r)[-1] == str(mn) and len(cr) == 0:
        cr.append(r)
    else:
        r += 10 - (r % 10)
        ar.append(r)
if len(cr) == 1:
    print(sum(ar) + cr[0])
else:
    print(sum(ar))

Solution (Python):
times = [ int(input()) for _ in range(5) ]
next_times = [ (x+9)//10*10 for x in times ]
print(min([sum(next_times)-next_times[i]+times[i] for i in range(5)]))

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

next_times = [0] * 5

for i, time in enumerate(times):
    next_times[i] = (time + 9) // 10 * 10

ans = 0xdeadbeef

for i in range(5):
    time = sum(next_times) - next_times[i] + times[i]
    ans = min(ans, time)

print(ans)

Solution (Python):
A=list(int(input())for i in range(5))
B=[a-a%10+10 if a%10!=0 else a for a in A]
diff=[(b-a)for a,b in zip(A,B)]
print(sum(B)-max(diff))

Solution (Python):
A=list(int(input())for i in range(5))
ans=0
num=0
com=0
for a in A:
    if a%10==0:
        ans+=a
    else:
        tmp=10-a%10
        ans+=(a//10+1)*10
        if com<tmp:
            com=tmp
            num=a
if num==0:
    print(ans)
else:
    ans-=(num//10+1)*10
    ans+=num
    print(ans)

Solution (Python):
from sys import stdin

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

idx = 0
wk = 9
for i,d in enumerate(a):
    dd = d % 10
    if dd == 0:
        continue
    if dd < wk:
        wk = dd
        idx = i

a[N-1],a[idx] = a[idx],a[N-1]

sum = 0
for i in range(N-1):
    if (a[i] % 10) != 0:
        sum += int((a[i] / 10 + 1)) * 10
    else:
        sum += int(a[i])

sum += a[N-1]

print(sum)

Solution (Python):
times = [int(input()) for _ in range(5)]
delays = [(10 - t) % 10 for t in times]
max_delay = max(delays)

print(sum(times) + sum(delays) - max_delay)

Solution (Python):
time = [0 for _ in range(5)]
wait = [0 for _ in range(5)]
for i in range(5):
    time[i] = int(input())
    wait[i] = 10 - (time[i] % 10)
    if wait[i] == 10:
        wait[i] = 0
print(sum(time) + sum(wait) - max(wait))

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

amari = []
totalTime = sum(t)

for num in t:
    if num%10 != 0:
        amari.append(10 - num%10)
amari.sort(reverse=True)

for i in amari[1:]:
    totalTime = totalTime + i

print(totalTime)

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

R=[a,b,c,d,e]
TT=0
t=[0]*5
T=[0]*5

for i in range(10):
	if (R[0]+i)%10 == 0:
		t[0]=a+i
	if (R[1]+i)%10 == 0:
		t[1]=b+i
	if (R[2]+i)%10 == 0:
		t[2]=c+i
	if (R[3]+i)%10 == 0:
		t[3]=d+i
	if (R[4]+i)%10 == 0:
		t[4]=e+i

for k in range(5):
    TT+=t[k]

for j in range(5):
    T[j]=TT-t[j]+R[j]
print(min(T))