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 = list(map(int,[input() for i in range(5)]))

a = lambda x:-(-x//10) * 10
b = lambda x:x % 10 if x % 10 !=0 else 10

aa = list(map(b, List))

a2 = aa.index(min(aa))
a3 = List.pop(a2)

print(sum(list(map(a,List)))+a3)

Solution (Python):
ABCDE = list(map(int,[input() for i in range(5)]))
waiting = [(10-a)%10 for a in ABCDE]
waiting.sort()
waiting.pop()
print(sum(waiting)+sum(ABCDE))

Solution (Python):
*li, = map(int, open(0).read().split())
new = []
mini = 10
for i in range(len(li)):
    if li[i] % 10 == 0:
        new.append(li[i])
    else:
        new.append(li[i] // 10 * 10 + 10)
        if mini > li[i] % 10:
            mini = li[i] % 10

print(sum(new)-(10-mini))

Solution (Python):
ds = [int(input()) for _ in range(5)]
def f(x):
  	return (x+9)//10*10
def g(x):
  	return 10-x%10 if x%10 else 0
print(sum(map(f,ds))-max(map(g,ds)))

Solution (Python):
num = [int(input()) for _ in range(5)]
num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

c = []
for i, j  in enumerate(num):
    n = j
    for k,l in enumerate(num2):
        if  k == i:
            continue
        else:
            n += l
    c.append(n)

print(int(min(c)))

Solution (Python):

import itertools
import math

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

ans = 10000000000

for order in itertools.permutations(ryori):
    t = sum([math.ceil(order[i]/10) * 10 for i in range(4)])
    t += order[4]
    ans = min(ans, t)

print(ans)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, D: int, E: int):
    p = [A,B,C,D,E]
    list = []
    for d in p:
        diff = 10 - d % 10
        if diff == 10:
            diff = 0
        list.append((diff,d))
    list.sort()
    sum = 0
    for i in range(4):
        sum += list[i][0] + list[i][1]

    print(sum + list[4][1])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    E = int(next(tokens))  
    solve(A, B, C, D, E)

if __name__ == '__main__':
    main()

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

Solution (Python):
dish=[int(input()) for i in range(5)]
print(sum([(dish[i]-1)//10+1 for i in range(5)])*10-9+min([(dish[i]-1)%10 for i in range(5)]))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=0
amari=[a%10,b%10,c%10,d%10,e%10]
nokori=list((10-amari[i])%10 for i in range(5))
maxi=max(nokori)
dish=[a,b,c,d,e]
for i in range(5):
  if dish[i]%10==0:
    s=s+dish[i]
  else:
    s=s+dish[i]+10-dish[i]%10
if maxi==0:
  print(s)
else:
  print(s-maxi)

Solution (Python):

"""
Created on Mon Apr  8 15:07:25 2019

@author: adachi-lab
"""

Y = 0
T = []
TT = []
TTT = []
TTTT = []
for i in range(5):
    input_code = int(input())
    T.append(input_code)
    
for q in range(5):
    TT.append(T[q]%10)
    
    if T[q]%10 == 0:
        TTT.append(T[q])
        
    else:
        TTT.append(((T[q]//10)*10)+10)
        
if min(TT) == 0:
    C = TT.count(0)
    for f in range(C):
        W1 = TT.index(min(TT))
        TT[W1] = 9
    
    W = TT.index(min(TT))
    TTT[W] = T[W]
    
else:
    W = TT.index(min(TT))
    TTT[W] = T[W]

for w in range(len(TTT)):
    Y += TTT[w]
    
print(Y)

Solution (Python):
from sys import exit


A = [0]*5
last = 129

for _ in range(5):
    A[_] = int(input())
    if(A[_]%10 != 0 and last%10 >= A[_]%10):
        last = A[_]
ans = 0
once = False
for a in A:
    if(a == last and not once):
        once = True
        continue
    if(a%10 != 0 ):
        a+=10 - a%10
    ans+=a
if(last == 129):
    print(ans)
else:
    print(ans+last)

Solution (Python):


order = []

for _ in range(5):
    menu = int(input())
    if menu%10 != 0:
        lossTime = 10 - menu % 10
    else:
        lossTime = 0
    order.append((lossTime, menu))
    
order.sort()

time = 0

for i in order:
    time += i[0] + i[1]
    
print(time - order[-1][0])

Solution (Python):
from operator import itemgetter
Dishes = [[0 for n in range(2)] for m in range(5)]
result = 0
most_loss = 0

for i in range(5):
    k = input()
    loss = 0  if int(k) % 10 == 0 else 10 - (int(k) % 10)
    Dishes[i][0] = int(k)
    Dishes[i][1] = loss
    if most_loss < loss:
        most_loss = loss
    result = int(k) + loss + result
    
result = result - most_loss
    
print(result)

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

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

last_food = []

for i in food:
	sub = i % 10
	sub_last_food = 10 - sub
	
	if sub_last_food == 10:
		x = 0
	else:
		x = sub_last_food
		
	last_food.append(x)
	
	
ans = max(last_food)


ans1 = last_food.index(ans)


for i in range(5):
	ans2 = food[i] + last_food[i]
	ans3 = ans3 + ans2
	

ans4 = ans3  - last_food[ans1]

print(ans4)

Solution (Python):


l,ll,m=[],[],[]
for i in xrange(5):
 l.append(int(raw_input()))
for i in xrange(5):
 m.append(l[i]%10)
s=130
idx=0
for i in xrange(5):
 if m[i]!=0:
  if m[i]<s:
   idx=i
   s=m[i]
for i in xrange(5):
 ll.append((l[i]+9)//10*10)
print sum(ll)-ll[idx]+l[idx]

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

temp = -1
s = 10
for i in range(5):
    x = a[i]
    if x % 10 == 0:
        b.append(x)
    else:
        b.append(x - (x % 10) + 10)
        if x % 10 < s:
            s = x % 10
            temp = i

if s == 10:
    print(sum(a))
else:
    print(sum(b) - b[temp] + a[temp])

Solution (Python):
A, B, C, D, E = [input() for _ in range(5)]
L = [A, B, C, D, E]
ans = 0
tmp = []
for l in L:
  if l[-1] != "0":
    tmp.append(l)
  else:
    ans += int(l)
if tmp:
  tmp.sort(key = lambda x: x[-1] if x[-1] != "0" else "")
  ans += int(tmp[0])
  for t in tmp[1:]:
    ans += (int(t)//10+1)*10
print(ans)

Solution (Python):
cook=[0]*5
omit=[0]*5

for i in range(5):
    cook[i]=int(input())
    omit[i]=cook[i]%10
    if omit[i]==0:
        omit[i]=10

loss=omit.index(min(omit))
time=cook[loss]
del cook[loss]
del omit[loss]

for i in range(4):
    cook[i]=cook[i]+10-omit[i]
    time=time+cook[i]

print(time)

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

l = [A,B,C,D,E]
m = [i%10 for i in l if i%10!=0 ]
if len(m) == 0:
  sub = 0
else:
  sub = 10 - min(m)
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)

Solution (Python):

 
from math import ceil
times = [int(input()) for i in range(5)]



times = sorted(times, key=lambda time: (time-1)%10)


times= [(ceil(time/10))*10 for time in times[1:]] + [times[0]]
print(sum(times))

Solution (Python):
import sys

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

smallest = 10
i = 0
sum = 0
arg_num = 0

for tmp in args[:4]:
    if tmp % 10 < smallest:
        if tmp % 10 != 0:
            smallest = tmp % 10
            arg_num = i
    i+=1



for i in range(5):
    if i != arg_num:
        if args[i] % 10 != 0:
            args[i] = args[i] + (10 - args[i] % 10)
    
    sum += args[i]

print(sum)

Solution (Python):
def kiriage(a):
  if a%10 == 0:
    return a
  else:
    return (a//10+1)*10
  
times = [int(input()) for i in range(5)]

age_times = sum([kiriage(i) for i in times])
lastdish = max([(10-j%10)%10 for j in times])

print(age_times - lastdish)

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

Solution (Python):


import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    A = [II() for _ in range(5)]

    res = sum(A)
    loss = []
    for a in A:
        loss.append((10 - int(str(a)[-1])) % 10)

    loss.sort()

    return res + sum(loss[:-1])


print(main())

Solution (Python):
from sys import exit

time = [int(input()), int(input()), int(input()), int(input()), int(input())]

total = 0
loss = []

for t in time:
    total += t
    if t % 10 != 0:
        loss.append(10 - t % 10)

if loss:
    total += sum(loss) - max(loss)

print(total)

Solution (Python):
input_val = [int(input()) for i in range(5)]
min_val = 10
min_index = 0
sum_time = 0
for i in range(0,5):
    str_num = str(input_val[i])
    if(int(str_num[len(str_num)-1]) < min_val) and (int(str_num[len(str_num)-1]) != 0):
        min_val = int(str_num[len(str_num)-1])
        min_index = i

for i in range(0,5):
    str_num = str(input_val[i])
    if(i==min_index):
        continue
    elif(int(str_num[len(str_num)-1])>0):
        sum_time += 10 - int(str_num[len(str_num)-1])

print(sum_time + sum(input_val))

Solution (Python):


def main():
    dishes = []
    for _ in range(5):
        dishes.append(int(input()))
    _sum = sum([maxtime(d) for d in dishes])
    _sum -= max([remtime(x) for x in dishes])
    print(_sum)
    
def maxtime(num):
    return (num + 9) // 10 * 10

def remtime(num):
    return maxtime(num) - num


if __name__ == '__main__':
    main()

Solution (Python):
import math

a=[0]*5
b=[10]*5
for i in range(5):
    a[i]=int(input().strip())
    r=a[i]%10
    if r!=0:
        b[i]=r
x=b.index(min(b))
num=0
for i in range(5):
    if i!=x:
        num+=math.ceil(a[i]/10)*10
num+=a[x]
print(num)

Solution (Python):
x = [int(input()) for i in range(5)]
y = [0,0,0,0,0]
last = 0
i = 0
while i < 5:
    if 0 < x[i]%10 < x[last]%10:
        last = i
    if x[i]%10 != 0:
        y[i] = x[i]//10*10+ 10
    else:
        y[i] = x[i]//10*10
    i += 1

z = 0
for i in range(5):
    if i != last:
        z += y[i]
    else:
        z += x[i]

print(z)

Solution (Python):
import numpy as np
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X = np.asarray([A,B,C,D,E])
X_div = X%10
X_sort = np.sort(X_div)
min=0
for i in range(5):
	if X_sort[i]!=0:
		min=X_sort[i]
		break
if min==0:
	min=10
X=10*((X-1)//10)+10

sum=0
for i in range(5):
	sum+=X[i]
print(sum-10+min)

Solution (Python):
import math

list = []
indent = 0
memory = 9
for i in range(5):
  list.append(int(input()))
  if memory > list[i] % 10 and list[i] % 10 > 0:
    indent = i
    memory = list[i] % 10

count = 0
for i in range(5):
  if i == indent:
    count += list[i]
  else:
    count += 10 * math.ceil(list[i]/10)

print(count)

Solution (Python):



import math
import itertools as itr


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

l_p = list(itr.permutations(l))
ans = 643
for l in l_p:
  ret = 0
  for t in l[:-1]:
    ret += math.ceil(t/10)*10
  ret += l[-1]
  ans = min(ret, ans)

print(ans)

Solution (Python):
time = 0
order_list = []

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


order_list = sorted(order_list, key=lambda x: ((x-1)%10), reverse=True)

for i in order_list[0:-1]:
        if i % 10 == 0:
                time += i
        else:
                time += (int(i/10)+1)*10

print(time+order_list[-1])

Solution (Python):
li = [int(input()) for _ in range(5)]
time = 0
min1 = 10
for i in range(5):
    a = li[i]
    if a % 10 != 0:
        time += (int(a/10) + 1) * 10
        if a % 10 < min1 :
            min1 = a % 10
    else:
        time += a
print(time - 10 + min1)

Solution (Python):
import math

"""
A = []
min_1 = 9
min_index = 0
for i in range(5):
    a = int(input())
    A.append(a)
    if (a%10 == 0):
        continue
    if (a%10 <= min_1):
        min_1 = a%10
        min_index = i

t = A.pop(min_index)
for a in A:
    if a%10 == 0:
        t += a
    else:
        t += ((a//10)+1)*10
print(t)
"""
def ten(a):
    return (a+9) // 10 * 10
def ichi(a):
    return ten(a) - a

A = []
for i in range(5):
    a = int(input())
    A.append(a)
B = [ten(a) for a in A]
C = [ichi(a) for a in A]
print(sum(B) - max(C))

Solution (Python):
import math


def find(lst):
    lst2 = []
    for li in lst:
        x = li % 10
        if x == 0:
            lst2.append(10)
        else:
            lst2.append(x)

    min_ = lst2[0]
    min_i = 0
    for i in range(len(lst2)):
        if lst2[i] < min_:
            min_ = lst2[i]
            min_i = i
    return min_i


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

min_i = find(F)

ans = 0
for i, fi in enumerate(F):
    if i == min_i:
        continue
    
    ans += (math.ceil(fi / 10)) * 10

ans += F[min_i]
print(ans)

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

Solution (Python):
def main():
    ans = 0
    mx = 0
    for _ in range(5):
        x = int(input())
        tmp = -(-x//10) * 10
        mx = max(tmp-x, mx)
        ans += tmp
    ans -= mx
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
time = 0
order_list = []

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

for i in range(4):
    next_order = order_list[i+1] % 10 if order_list[i+1] % 10 != 0 else 10
    if order_list[i] % 10 < next_order:
        buff = order_list[i]
        order_list[i] = order_list[i+1]
        order_list[i+1] = buff

for i in range(5):
    wait = 10 - order_list[i] % 10
    if wait == 10 or i == 4:
        wait = 0
    time += order_list[i] + wait

print(time)

Solution (Python):
a = [int(input()) for _ in range(5)]
r_min = 10
r_idx = -1
res = 0
for i in range(len(a)):
  r_ = a[i] % 10
  res += (a[i] // 10) * 10 + int(r_ > 0) * 10
  if r_ == 0:
    r_ = 10
  if r_ < r_min:
    r_min = r_
    r_idx = i

if r_min < 10:
  res -= 10 - r_min
print(res)

Solution (Python):
import math

times = [input() for _ in range(5)]
mini = times[0]
for i, _ in enumerate(times):
    if i >= 4:
        break
    if int(_[-1]) != 0 and int(_[-1]) < int(mini[-1]):
        mini = _

times.remove(mini)

sums = sum([int(math.ceil(int(_)/10)*10) for _ in times])
sums += int(mini)
print(sums)

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

for i in range(5):
    extra.append(times[i] % 10)

ans = 0

for time in times:
    ans += time // 10 * 10
    if time % 10 != 0:
        ans += 10

loss = [10 - e if e != 0 else 0 for e in extra]
ans -= max(loss)
print(ans)

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

from itertools import permutations
ans = 643

def kiriage(i):
    if i % 10 == 0:
        return i
    else:
        juu = i // 10
        return (juu + 1) * 10

for *ts, t5 in permutations(time, 5):
    time_took = 0
    for t in ts:
        time_took += kiriage(t)
    time_took += t5
    ans = min(ans, time_took)

print(ans)

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

ans = 0
min_wait = 99
for t in needs:
    wait = t % 10
    if wait == 0:
        ans += t
    else:
        min_wait = min(min_wait, t % 10)
        ans += (t // 10 + 1) * 10
if min_wait != 99:
    ans = ans - 10 + min_wait

print(ans)

Solution (Python):
import math

def main():
    ABCDE = [int(input()) for _ in range(5)]
    d = [(k, 10 - (k % 10) if k % 10 != 0 else 0,) for k in ABCDE]
    d.sort(key=lambda x:x[1])
    abced = [k[0] for k in d]
    result = 0
    for i in abced[:-1]:
        if i % 10 == 0:
            result += i
        else:
            result += 10 * math.ceil(i / 10)
    result += abced[-1]
    print(result)

if __name__ == "__main__":
    main()

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

moda = [a[i] % 10 for i in range(5)]
for num, i in enumerate(moda):
    if i == 0:
        moda[num] = 10

print(sum(a)-sum(moda)+40+min(moda))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
A=[a,b,c,d,e]
B=[]
C=[]
for i in range(5):
    if A[i]%10==0:
        B.append(10)
        C.append(A[i])
        
    else:
        B.append(A[i]%10)
        C.append((A[i]//10+1)*10)
j=B.index(min(B))
print(sum(C)-C[j]+A[j])

Solution (Python):


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


cooking_time = sorted(cooking_time, key=lambda x: (x-1)%10, reverse=True)

ans = 0

for i , cooking_time in enumerate(cooking_time):
    
    if i < 4:
        if cooking_time%10 != 0:
            
            ans += cooking_time + (10-cooking_time%10)
        else:
            ans += cooking_time
    
    else:
        ans += cooking_time

print(ans)

Solution (Python):
n=[0]*5
x=10
flag=0
sum=0
for i in range(5):
  n[i]=int(input())
  if n[i]%10!=0 and n[i]%10<x:
    x=n[i]%10
    flag=i
for i in range(5):
  if i!=flag and n[i]%10!=0:
    sum+=(n[i]+(10-n[i]%10))
  else:
    sum+=n[i]
print(sum)

Solution (Python):
a=[int(input()) for i in range (5)]
m=[]
s=0
for j in range(5):
    x=a[j]%10
    if x!=0:
        s+=a[j]+10-x
    else:
        s+=a[j]
for k in range(5):
    y=a[k]%10
    b=s
    if y!=0:
        n=10-y
        b=b-n
        m.append(b)
    else:
        m.append(b)
print(min(m))

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

ls = [A,B,C,D,E]
m = 10**10

for l in range(0,5):
    c = 0
    for j in range(0,5):
        if l == j:
            c+=ls[j]
        else:
            x = ls[j]
            while x%10 != 0:
                x+=1
            c+=x
    m = min(m,c)
print(m)

Solution (Python):
a = [int(input()) for _ in range(5)]
b = [(10-(i%10))%10 for i in a]
c = max(b)
print(sum([((j + 9)//10) * 10 for j in a]) - c)

Solution (Python):
dish = [0]*5
inv = [0]*5

for i in range(5):
  dish[i] = int(input())
  inv[i] = (10-dish[i]%10)%10
  
cost = sum(dish) + sum(inv) - max(inv)
print(cost)

Solution (Python):
a = [int(input()) for i in range(5)]
b = list(map(lambda x:(x+9)//10*10, a))
print(min([sum(b)-b[i]+a[i] for i in range(5)]))

Solution (Python):
import itertools
A = []
for i in range(5):
  a = int(input())
  A.append(a)
  
Comb = list(itertools.permutations(A))
min_time = float('inf')
for i in range(len(Comb)):
  tmp = list(Comb[i])
  tmp_time = 0
  for j in range(5):
    if(j != 4):
     if(tmp[j]%10 == 0): tmp_time += tmp[j]
     else: tmp_time += 10*(tmp[j]//10 + 1)
    if(j == 4):
     tmp_time += tmp[j]
  min_time = min(min_time,tmp_time)
print(min_time)

Solution (Python):
x = 0
t = 0
for n in range(5):
    o = int(input())
    if o % 10 == 0:
        k = 0
    else:
        k = 10 - o % 10
    t += o + k
    x = max(x, k)
print(t - x)

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

aMod = [0, 0, 0, 0, 0]
for i in range(0,5):
    aMod[i] = a[i] % 10
    if aMod[i] == 0:
        aMod[i] = 10
    a[i] = a[i] + (10 - aMod[i])

aModMin = min(aMod)
print(sum(a) + aModMin - 10)

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

Solution (Python):
import math
dish = [int(input()) for _ in range(5)]
sm = 9
smin = 0
for cnt, item in enumerate(dish):
  r = item % 10
  if 1 <= r <= 9:
    if sm > r:
      sm = r
      smin = cnt
ans = 0    
for cnt, item in enumerate(dish):
  if cnt == smin:
    ans += item
  else:
    r = item % 10
    if 1 <= r <= 9:
      ans += item + 10 - r
    else:
      ans += item
print(ans)

Solution (Python):
import numpy as np
A=[int(input()) for i in range(5)]
B=[]
for i in range(5):
    if int(str(A[i])[-1])!=0 and len(str(A[i]))>2:
        B.append(int(str(A[i])[:-2]+str(int(str(A[i])[-2])+1)+'0'))
    elif int(str(A[i])[-1])!=0 and len(str(A[i]))==2:
        B.append(int(str(int(str(A[i])[0])+1)+'0'))
    elif int(str(A[i])[-1])!=0 and len(str(A[i]))==1:
        B.append(10)
    else:
        B.append(int(A[i]))
a=np.array(A)
b=np.array(B)
np.array(B)-np.array(A)
tmp=np.sort(b-a)
print(sum(tmp)+sum(a)-tmp[-1])

Solution (Python):
from math import ceil
a = [int(input()) for _ in range(5)]
b = [ceil(i / 10) * 10 for i in a]
c = [sum([a[i]] + [b[j] for j in range(5) if i != j]) for i in range(5)]
print(min(c))

Solution (Python):
A = [int(input()) for i in range(5)]
amari = A[0] % 10
index = 0

for i in range(1, 5):
    if 0 < A[i] % 10 < amari:
        amari = A[i] % 10
        index = i

for i in range(5):
    if i == index:
        continue
    for j in range(10):
        if A[i] % 10:
            A[i] += 1
        else:
            break

print(sum(A))

Solution (Python):
from math import ceil
a = [int(input()) for _ in range(5)]
b = [ceil(i / 10) * 10 for i in a]
print(min([sum([a[i]] + [b[j] for j in range(5) if i != j]) for i in range(5)]))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
li=[a,b,c,d,e]
p=[]
q=[]
for i in range(5):
  p.append(((li[i]-1)//10+1)*10)
  q.append(((li[i]//10+1)*10-li[i])%10)
print(sum(p)-max(q))

Solution (Python):
import itertools
import math

def culc(o):
  time = o[0]
  for i in o[1:]:
    time = math.ceil(time / 10) * 10
    time += i
  return time

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

p = list(itertools.permutations(d))
time = [culc(i) for i in p]

print(min(time))

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

a1=a%10
b1=b%10
c1=c%10
d1=d%10
e1=e%10

if a1 != 0:
    a1=10-a1
if b1 != 0:
    b1=10-b1
if c1 != 0:
    c1=10-c1
if d1 != 0:
    d1=10-d1
if e1 != 0:
    e1=10-e1

x={'a1':a1,'b1':b1,'c1':c1,'d1':d1, 'e1':e1}

max=max(x,key=x.get)

if max == 'a1':
    print(b+b1+c+c1+d+d1+e+e1+a)
elif max == 'b1':
    print(a+a1+c+c1+d+d1+e+e1+b)
elif max == 'c1':
    print(a+a1+b+b1+d+d1+e+e1+c)
elif max == 'd1':
    print(a+a1+b+b1+c+c1+e+e1+d)
else:
    print(a+a1+b+b1+c+c1+d+d1+e)

Solution (Python):

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

dishs=[A,B,C,D,E]
time=[]
time1=[]
for henkan in dishs:
    time.append(int(henkan))
    time1.append(int(henkan[-1]))


def shori(n):
    if n==0 :
        k=0
    else:
        k=10-n
    return k
time1a=list(map(shori,time1))
last=max(time1a)
totaltime=sum(time)+sum(time1a)-last

print(totaltime)

Solution (Python):
import itertools
args = []
for _ in range(5):
    tmp = int(input())
    args.append(tmp)
best = 643
for perm in itertools.permutations(args):
    remainder = 0
    cook = 0
    for i, t in enumerate(perm):
        cook += t
        if i == 4:
            break
        while(cook % 10 != 0):
            cook += 1

    cook += remainder
    if cook < best:
        best = cook
print(best)

Solution (Python):
x = [int(input()) for i in range(5)]
time = sum([(i // 10)*10 for i in x])
res = [i % 10 for i in x if i % 10 != 0]
if len(res) > 0:
    time += (len(res) - 1)*10 + min(res)
print(time)

Solution (Python):
import math
a=[]
m=10
n=5
ans=0
for i in range(n):
    t=int(input())
    m=min(m,t%10 if t%10!=0 else 10)
    ans+=math.ceil(t/10)*10
ans+=m-10

print(ans)

Solution (Python):


from numpy import array, argmax, ones

InRange = 5


a_e = array([int(input()) for i in range(InRange)])


a_e10 = 10 - a_e % 10
a_e10[a_e10 == 10] = 0

sum_index = ones(InRange, dtype=bool)
sum_index[argmax(a_e10)] = False

sum_time = a_e.sum() + a_e10[sum_index].sum()

print(sum_time)

Solution (Python):
a = 0
l = []
for _ in range(5):
  x = int(input())
  a += x
  l += [(200-x)%10]
print(a+sum(l)-max(l))

Solution (Python):
import sys, os

if __name__=='__main__':
    if 'local' in os.environ :
        sys.stdin = open('./input.txt', 'r')
    
    ans = 0
    min_mod = 10
    for i in range(5):
        x = int(input())
        ans += x//10 * 10 + (0 if x%10 == 0 else 10);
        if x%10 != 0:
            min_mod = min(min_mod, x%10);
        
    
    if min_mod == 10:
        print(ans)
    else:
        print(ans - 10 + min_mod)

Solution (Python):
import math
def main():
    num       = [int(input()) for _ in range(5)]
    rand_up   = [math.ceil(i / 10) * 10 for i in num]
    diff      = [rand_up[i] - num[i] for i in range(5)]
    max_index = diff.index(max(diff))
    print(sum([num[i] if i == max_index else rand_up[i] for i in range(5)]))

main()

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

next_time_ae = [(x + 9)//10 * 10 for x in a_e]

diff = [(b - a) for a, b in zip(a_e, next_time_ae)]

print(sum(next_time_ae)-max(diff))

Solution (Python):





A_E = [input() for _ in range(5)]


unit_place_lst = [int(x[-1]) for x in A_E]
min_except0 = 10
min_index = 0
for i, n in enumerate(unit_place_lst):
    if 0 < n < min_except0:
        min_except0 = n
        min_index = i

ans = 0
for i, x in enumerate(A_E):
    if i == min_index:
        ans += int(x)
    
    
    
    
    else:
        ans += (int(x) + 9)//10 * 10

print(ans)

Solution (Python):
def solve(t):
    n = len(t)
    p = [t[i] % 10 for i in range(n)]
    q = [(10 - p[i]) % 10 for i in range(n)]
    return sum(t) + sum(q) - max(q)
t = [int(input()) for i in range(5)]
print(solve(t))

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

dishes=[I() for i in range(0,5)]
rounded = []
for i in dishes:
    if i%10 != 0:
        i += 10 - i % 10
    rounded.append(i)
result=10**10
for i in range(len(dishes)):
    
    result = min(result, sum([r for ridx, r in enumerate(rounded) if ridx != i]) + dishes[i])
    
print(result)

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

m = 0
res = 0
for x in a:
    if x % 10 != 0:
        t = 10 - x%10
    else:
        t = 0
    res += x + t

    m = max(m, t)

print(res - m)

Solution (Python):
l=[int(input()) for i in range(5)]
m=[c%10 for c in l if c%10>0]

def f(c):
    if c%10>0:
        return c+10-c%10
    else:
        return c

t=[f(c) for c in l]

ans=sum(t)
if len(m)>0:
  ans-=10-min(m)
print(ans)

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

Solution (Python):
p={} 
r={} 
for i in range(5):
    p[i] = int(input())
    r[i] = int((p[i] + 9) /10) * 10
    

"""
for i in range(5):
    print(p[i],end=' ')
print('')

for i in range(5):
    print(r[i],end=' ')
print('')
"""
lastnum = 0
for i in range(1,5):
    if r[lastnum] - p[lastnum] < r[i] - p[i]:
        lastnum = i



time = 0
for i in range(5):
    if i != lastnum:
        time += r[i]
    else:
        time += p[i]

print(time)

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

r = [c % 10 for c in cuicine if c % 10 != 0]

r = sorted(r)



rmin = 0

if r != []:
  rmin = r.pop(0)

ans = sum(cuicine)

for i in r:
  ans += 10 - i

print(ans)

Solution (Python):
from itertools import permutations
a = [int(input()) for _ in range(5)]
ans = float('inf')
for last,*others in permutations(a):
    time = last
    for o in others:
        time += (o+9)//10*10
    ans = min(ans, time)
print(ans)

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

ans = float('inf')
for last in range(5):
    time = a[last]
    for other in range(5):
        if other==last:
            continue
        time += (a[other]+9)//10*10
    ans = min(ans, time)
print(ans)

Solution (Python):
menu = [int(input()) for i in range(5)]
mod = []
for i in menu:
    mod.append(i % 10)
last_index = 0
for i in range(5):
    if mod[last_index] > mod[i] and mod[i] >= 1:
        last_index = i
res = 0
for i, v in enumerate(menu):
    if i == last_index:
        continue
    res += v
    while res % 10 != 0:
        res += 1

res += menu[last_index]
print(res)

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

m = 0
sum_a = 0
for x in a:
    if x%10 != 0:
        t = 10 - x%10
    else:
        t = 0
    sum_a += x+t
    m = max(m, t)

print(sum_a - m)

Solution (Python):
import numpy as np
import math

a = []
for i in range(5):
	a.append(int(raw_input()))
b = np.array(a)
c = b % 10
c[c==0]=10
min_id = np.argmin(c)

for i in range(5):
	if i != min_id:
		b[i] = 10 * math.ceil(b[i] / 10.0)
print np.sum(b)

Solution (Python):
inputs = [int(input()) for i in range(5)]
summ = 0
k = 10
for i in inputs:
    if i % 10 == 0:
        summ = summ + i
    else:
        s, m = divmod(i, 10)
        summ = summ + (s + 1) * 10
        if m < k:
            k = m

summ = summ -((10-k)%10)
print(summ)