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 math
import copy
from collections import Counter
from _ast import Or
 
 
 
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:
 
            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
 

a=nCast(inputArr(5))


                   
   

def func():
    min=10
    for k in a:
        if k%10!=0 and k%10<min:
            min=k%10
    sum=0
    for k in a:
        if k%10==0:
            sum+=k
        elif min==-1 or k%10!=min:
            sum+=(int(k/10)+1)*10
        else:
    
            sum+=k
            min=-1
    return sum
print(func())

Solution (Python):
a=[0]*5
index=0
index_0=0
count=9
s=0
j=0
for i in range(5):
    a[i]=int(input())
    if a[i]%10==0:
        index_0+=1
    else:
        count=min(a[i]%10,count)
        j+=1
    s+=a[i]//10
if j!=0:
    print(s*10+count+(4-index_0)*10)
else:
    print(sum(a))

Solution (Python):
time = [int(input()) for _ in range(5)]
sub = [0]*5
time = sorted(time, key=lambda x:10-(x%10) if x % 10 != 0 else 0)
total = 0
for n, i in enumerate(time):
    total += i
    if i % 10 != 0 and n != 4:
        total += 10 - (i % 10)
print(total)

Solution (Python):
import numpy as np


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

b = []
for item in a:
    b.append(item%10)

c = []
for i in range(5):
    c.append(a[i] - b[i])

ans = sum(c)
b.sort()

flg = True
for i in range(5):
    if b[i] != 0:
        if flg:
            ans = ans + b[i]
            flg = False
        else:
            ans = ans + 10
print(ans)

Solution (Python):
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lis = [a, b, c, d, e]
l = list(itertools.permutations(lis))
count = 10 ** 9
for ll in l:
    ans = 0
    c = 0
    for seq in ll:
        c += 1
        ans += seq
        mod = seq % 10
        if mod != 0 and c != 5:
            ans += 10 - mod
    count = min(count, ans)
print(count)

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

total = 0
for e in l:
    if e % 10 == 0:
        total += e
    else:
        total += (int(e / 10)) * 10 + 10

mi = 10
for e in l:
    if e % 10 == 0:
        continue
    mi = min( mi, e % 10 )

print(total - 10 + mi)

Solution (Python):
fin = 10
ans = 0
for i in range(5):
    tmp = int(input())

    if tmp%10 != 0:
        fin = min(tmp%10, fin)
        tmp = tmp - tmp%10 + 10
    ans += tmp

ans = ans - (10-fin)
print(ans)

Solution (Python):
l=[int(input()) for i in range(5)]
ans=0
m=10
for i in l:
    mod=i%10
    if mod!=0:
        m=min(m,mod)
        ans+=i+(10-mod)
    else:
        ans+=i
print(ans-(10-m))

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = a+b+c+d+e
l = []
l.append((10-a%10)%10)
l.append((10-b%10)%10)
l.append((10-c%10)%10)
l.append((10-d%10)%10)
l.append((10-e%10)%10)
l.sort()
print(s+sum(l[:-1]))

Solution (Python):
import numpy as np

dish = []
for _ in range(5):
    tmp = int(input())
    dish.append([tmp, (10-tmp%10)%10])

dish = np.array(dish)
dish = dish[np.argsort(dish[:, 1])]

count = 0
print(np.sum(dish) - dish[4, 1])

Solution (Python):
A=[int(input()) for i in range(5)]
A.sort(key=lambda x:10-(x%10) if x%10!=0 else 0,reverse=True)
ans=0
for i in A[1:]:
  ans+=i+(10-i%10 if i%10!=0 else 0)
print(ans+A[0])

Solution (Python):
def m():
    A = []
    for _ in range(5):
        a = int(input())
        A.append(a)

    amari = 10
    tmp = 0
    for i in range(5):
        if A[i] % 10 == 0:
            continue
        if (A[i] % 10) < amari:
            tmp = i
            amari = A[i] % 10
    if amari == 10:
        return sum(A)
    ans = []
    for i in range(5):
        if i == tmp:
            ans.append(A[tmp])
            continue
        if A[i] % 10 == 0:
            ans.append(A[i])
            continue
        ans.append(A[i] + (10 - A[i]%10))
    return sum(ans)
print(m())

Solution (Python):
a=[int(input()) for _ in range(5)]
ar=[[i,a[i]%10] for i in range(5)]
ar.sort(key=lambda x:x[1])
i=0
while ar[i][1]==0:
    i+=1
    if i==4:
        break
k=ar[i][0]
time=0
for i in range(5):
    if i!=k:
        time+=a[i]
        if a[i]%10!=0:
            time+=10-a[i]%10
time+=a[k]
print(time)

Solution (Python):
import itertools

L=[ input() for i in range(5)]

P=list(itertools.permutations( range(5) ))
ans=float("inf")

for p in P:
	t=0
	for idx, x in enumerate(p):
		t+=L[x]
		if t%10!=0 and idx!=4 :
			t+=10- (t%10)
	ans=min(ans,t)

print ans

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

a = []

for i in range(5):
    a.append(int(dish[i][-1]))

r = []

for i in range(5):
    r.append(int(dish[i]))
    
for i in range(5):
    if a[i] == 0:
        a[i] += 10

for i in range(5):
    if i != a.index(min(a)):
            r[i] += 10 - a[i]

print(sum(r))

Solution (Python):
import sys
from collections import deque
import copy
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    A = []
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))


    max_idx = 0
    max_mod = 0
    for i in range(5):
        if abs(10 - A[i] % 10)% 10> max_mod:
            max_mod = abs(10 - A[i] % 10) % 10
            max_idx = i
    time = 0
    for i in range(5):
        if i != max_idx:
            time += A[i] + (abs(10 - A[i] % 10)% 10)
    time += A[max_idx]
    print time


if __name__ == '__main__':
    main()

Solution (Python):

"""
Created on Sat Feb 16 20:52:46 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

    
all(nstr.count(c) for c in '753')


ABT = zip(A, B, totAB)
result = 0

sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)


(x >> i) & 1


dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

"""

A = [0]*5

A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

A1 = [0]*5
for i in range(len(A)):
    A1[i] = A[i]%10
    if A1[i] == 0:
        A1[i] = 10

last_menu = find_index(A1, min(A1), default=False)
time = 0
for i in range(len(A)):
    if i == last_menu:
        time += A[i]
    else:
        time += A[i] - A1[i] +10 
print(time)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
alist = [A,B,C,D,E]
A_=10-A%10
B_=10-B%10
C_=10-C%10
D_=10-D%10
E_=10-E%10

mlist = [A_,B_,C_,D_,E_]
for i,m in enumerate(mlist):
    if m==10:
        mlist[i]=0
min_index = mlist.index(max(mlist))

for i in range(5):
    if i!=min_index:
        alist[i]+=mlist[i]
print(sum(alist))

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

sum_num = 0

delta = 10

for num in a:
    if num % 10 != 0 and num % 10 < delta:
        delta = num % 10
    sum_num += math.ceil(num / 10) * 10

print(sum_num - 10 + delta)

Solution (Python):
a = []
while True:
    try:
        a.append(int(input()))
    except:
        break

def time(at):
    t = 0
    while t < at:
        t += 10
    return t, t - at

st = 0
max_d = 0
for i in a:
    t, d = time(i)
    st += t
    if max_d < d:
        max_d = d

print(st - max_d)

Solution (Python):

"""
Created on Sat Apr  6 20:39:40 2019

@author: Yamazaki Kenichi
"""
import math

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

a = 10
if A%x != 0:
    a = min(a,A%x)
if B%x != 0:
    a = min(a,B%x)
if C%x != 0:
    a = min(a,C%x)
if D%x != 0:
    a = min(a,D%x)
if E%x != 0:
    a = min(a,E%x)
if 0 == max(A%x,B%x,C%x,D%x,E%x):
    a = 10
b = math.ceil(A/x) + math.ceil(B/x) + math.ceil(C/x) + math.ceil(D/x) + math.ceil(E/x)

print((b-1)*10 + a)

Solution (Python):
info = [int(input()) for _ in range(5)]
degit_1 = [(10-e % 10) % 10 for e in info]
ans = sum(info) + sum(degit_1) - max(degit_1)
print(ans)

Solution (Python):
lst = [int(input()) for i in range(5)]
ans=0
tmpl=[]
for i in range(5):
    ans+=lst[i]
    if(lst[i]%10!=0):
        ans+=10-lst[i]%10
for i in lst:
    if(i%10==0):
        tmpl+=[10]
    else:
        tmpl+=[i%10]
ans-=10-min(tmpl)
print(ans)

Solution (Python):
*a,=map(int,open(0).read().split())
b=[i%10 if i%10!=0 else 99 for i in a ]
c=a.pop(b.index(min(b)))
ans=0

for i in a:
    
    ans+=(i//10*10+(i%10>0)*10)
print(ans+c)

Solution (Python):
import sys
import itertools
atn = []
for i in range(5):
    atn.append(int(input()))

seq = list(itertools.permutations(atn))
ans = 10**10
for s in seq:
    tmp_ans = 0
    for i in s:
        
        div = (10-(tmp_ans %10))
        div = div if div <10 else 0
        tmp_ans += div
        
        tmp_ans += i
        
    if tmp_ans < ans:
        ans = tmp_ans
print(ans)

Solution (Python):
ans = 0
used = False
mins = [int(input()) for _ in range(5)]
maa = list(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
m = (0,0) if len(maa) == 0 else sorted(maa)[0]
for menu in mins:
  if used==False and menu==m[1]:
    used=True
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])

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

Solution (Python):
import math


nums = list(map(int, [input() for _ in range(5)]))
s = sum(math.ceil(num / 10) * 10 for num in nums)
m = min([int(str(num)[-1]) for num in nums if num % 10 != 0], default=0)
if m != 0:
  s -= (10-m)
print(s)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
alpha = 0
m = str(A)[-1]
menu = [[A, int(str(A)[-1])], [B, int(str(B)[-1])],
        [C, int(str(C)[-1])], [D, int(str(D)[-1])],
        [E, int(str(E)[-1])]]
menu.sort(key = lambda x:x[1])
f = False
ans = 0
for time, i in menu:
    if i != 0 and not f:
        ans += time
        f = True
    else:
        ans += (time + 9) // 10 * 10
print(ans)

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

Solution (Python):

import math
A = [0] * 5
B = [0] * 5
for i in range(len(A)):
    A[i] = int(input())
    B[i] = ((A[i] - 1) % 10) + 1
    A[i] = math.ceil(A[i]/10)*10
min_b = min(B)
print(sum(A)-10+min_b)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
List = [a,b,c,d,e]
wait = []
for i in List:
    tmp = 10-i%10
    if tmp ==10:
        tmp = 0
    wait.append(tmp)

for i in range(5):
    ans += List[i]+wait[i]
print(ans-max(wait))

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

ANS=0
for i in range(4):
    ANS+=-(-LIST[i]//10)*10

print(ANS+LIST[-1])

Solution (Python):
ipt=[int(input()) for x in [0]*5]
ans=10**10
for i in range(5):
    tmpans=0
    for j in range(5):
        if i==j:
            tmpans+=ipt[j]
        else:
            if ipt[j]%10!=0:
                tmpans+=(ipt[j]//10 +1)*10
            else:
                tmpans+=ipt[j]
    ans=min(ans,tmpans)
print(ans)

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

nums = [A, B, C, D, E]
max_num = max(nums)

rest_time = [(10 - num % 10) % 10 for num in nums]

print(sum(nums) + sum(rest_time) - max(rest_time))

Solution (Python):
a = list()
b = list()
for i in range(0,5):
    a.append(int(input()))
    b.append(a[i] % 10)

while True:
    if 0 in b:
        b.remove(0)
        b.append(10)
    else:
        break

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

Solution (Python):
A = []
min_res = 11

for i in range(5):
  a = int(input())
  A.append(a)
  tmp = a%10
  if(tmp == 0): 
    tmp = 10
  if(min_res > tmp):
    min_res = tmp
    min_index = i

ans = 0
for i in range(5):
  a = A[i]
  if(i != min_index):
    if(a%10 == 0):
      ans += a
    else:
      tmp = 10 - a%10
      ans += a + tmp
  else:
    ans += a
print(ans)

Solution (Python):
minute = [int(input()) for _ in range(5)]
mod = [x % 10 for x in minute]
wait = [0 if x == 0 else 10 - x for x in mod]
wait.remove(max(wait))
print(sum(minute)+sum(wait))

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

min = 9
min_idx = 0
for i, n in enumerate(l):
    m = n % 10
    if m != 0 and m < min:
        min = m
        min_idx = i

sum = 0
for i, n in enumerate(l):
    if min_idx == i or n % 10 == 0:
        sum += n
    else:
        sum += (n // 10 + 1) * 10

print(sum)

Solution (Python):
A = [int(input()) for _ in range(5)]
tmp = 10
ans = 0
for a in A:
    mod = a % 10
    if mod == 0:
        ans += a
    else:
        ans += a - mod + 10
        tmp = min(tmp, mod)
ans += tmp - 10
print(ans)

Solution (Python):

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

    amari = 0
    amari_max = 0
    for i in range(5):
        if a[i] % 10 != 0:
            amari += 10 - a[i] % 10
            if amari_max <  10 - a[i] % 10:
                amari_max = 10 - a[i] % 10
    print(sum(a)+amari-amari_max)

main()

Solution (Python):
times = []

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

min_over = 9
loss_index = 0

for index, time in enumerate(times):
    step, mod = divmod(time, 10)
    if mod != 0:
        if min_over > mod:
            loss_index = index
            min_over = mod

fin = 0
for i in range(5):
    if i == loss_index:
       fin += times[i]
    else:
        step, mod = divmod(times[i], 10)
        if mod == 0:
            fin += times[i]
        else:
            fin += (step + 1) * 10

print(fin)

Solution (Python):


def io_generator():
	return input()




def gt(t):
	m=t%10
	if m > 0:
		return t+(10-m),10-m
	return t,0
	
def main(io):
	l =[ int(io()) for _ in range(5)]
	ll=[gt(t) for t in l]
	dd= sum([t[0] for t in ll])
	nn=max([t[1] for t in ll])
	return dd-nn



if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Solution (Python):
a=0
lists=[0]
minb = 0
for _ in range(5):
    b=input()
    if b[-1]!='0':
        lists.append(10-int(b[-1]))
        if len(b) != 1:
            a=a+(int(b[:-1])+1)*10
        else:
            a=a+10
    else:
        a=a+int(b)
print(a-max(lists))

Solution (Python):
import itertools

X = [int(input()) for _ in range(5)]
mi = 10 ** 5
for xi in itertools.permutations(X, 5):
    count = 0
    for i, a in enumerate(xi):
        count += a
        if i < 4:
            count += (10 - (count % 10)) % 10
    mi = min(mi, count)

print(mi)

Solution (Python):

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

time = 0

min_r = 10
for i in a:
    r = i % 10
    if r == 0:
        time += i
    else:
        time += i + 10 - r
        min_r = min(r, min_r)

if min_r != 10:
    time -= 10 - min_r 

print(time)

Solution (Python):
A = [input() for i in range(5)]
A.sort(key = lambda x:x[-1])
A = [int(a) for a in A]
res = 0
for a in A:
	if a%10 == 0:
		res += a
	else:
		while a%10 != 0:
			a += 1
		res += a 
for a in A:
	b = str(a)
	if b[-1] != '0':
		res -= 10-int(b[-1])
		print(res)
		exit()
print(res)

Solution (Python):
from math import ceil as c;a=[int(input())for i in range(5)];print(sum([c(i/10)for i in a])*10-max([c(i/10)*10-i for i in a]))

Solution (Python):
dish = []
for i in range(5):
    dish.append(int(input()))
ichi = 0
for i in range(1,5):
    if dish[i]%10 > 0 and dish[ichi] % 10 > dish[i] % 10:
        ichi = i
for i in range(5):
    if i != ichi and dish[i]%10 > 0:
        dish[i] += 10 - dish[i]%10
print(sum(dish))

Solution (Python):
total = 0
m = 10
for _ in range(5):
  t = int(input())

  total += ((t-1) // 10 + 1) * 10

  if 0 < t % 10 < m:
    m = t % 10

print(total-10+m)

Solution (Python):
import math
count = 0
diff = 0
for i in range(5):
  tmp = int(input())
  count += math.ceil(tmp/10)*10
  if math.ceil(tmp/10)*10 - tmp > diff:
    diff = math.ceil(tmp/10)*10 - tmp
print(count - diff)

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

min1 = 10
temp = 0
for i in range(5):
    if (a[i]-1) %10 < min1:
        min1 = (a[i]-1) %10
        temp = i
        
count = 0
for i in range(5):
    if i == temp:
        count += a[i]
    else:
        count += (int((a[i]-1)/10)+1)*10

print(count)

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    A = [int(input()) for _ in range(5)]

    ans = 0
    B = []
    for a in A:
        if a % 10 == 0:
            ans += a
        else:
            B.append(a)

    B = sorted(B, key=lambda x: -(x%10))
    n = len(B)
    for i in range(n-1):
        ans += (B[i] // 10 + 1) * 10

    if n > 0:
        ans += B[n-1]


    return ans


if __name__ == '__main__':
    print(main())

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

b = sorted([i % 10 for i in a if i % 10 != 0])

ans = sum(a)

for i in range(len(b) - 1):
    ans += (10 - b[i + 1])

print(ans)

Solution (Python):
s = []
min = 10
sum = 0
for i in range(5):
  s.append(int(input()))
  if min>s[i]%10 and s[i]%10 != 0:
    min = s[i]%10    
for j in s:
  if j%10 != 0:
    sum += (j//10+1)*10
  else:
    sum += j

print(sum-(10-min))

Solution (Python):
import numpy as np
S = np.zeros(5)
s = np.zeros(5)

S[0] = int(input())
S[1] = int(input())
S[2] = int(input())
S[3] = int(input())
S[4] = int(input())
ANS = 0
for i in range(5):
    s[i] = (S[i]-1)%10
    ANS = ANS -(-S[i]//10)*10

ANS = ANS - (10-(s[s.argmin()]+1))
print(str(int(ANS)))

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

Solution (Python):
a = [0]*5
a_one = [0]*5
a_ten = [0]*5
for i in range(5):
    a[i] = int(input())
    a_one[i] = a[i]%10
    if a_one[i] == 0:
        a_one[i] = 10
    a_ten[i] = abs(10-a_one[i])

min_one_index = a_one.index(min(a_one))
ans = 0
for i in range(5):
    if i != min_one_index:
        ans += a[i]+a_ten[i]
    else :
        ans += a[i]
print(ans)

Solution (Python):
import math

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

about = [math.ceil(a/10)*10,math.ceil(b/10)*10,math.ceil(c/10)*10,math.ceil(d/10)*10,math.ceil(e/10)*10]
one = [a%10,b%10,c%10,d%10,e%10]
one.sort()
count = 0
for i in one:
    if i != 0:
        count = i
        break
if sum(one) == 0:
    count = 10
print(sum(about)+count-10)

Solution (Python):
price = [int(input()) for _ in range(5)]
min_sum = float('inf')
for i in range(5):
    sum = 0
    for j in range(5):
        if j == i:
            sum += price[i]
        else:
            if price[j] % 10 == 0:
                sum += price[j]
            else:
                sum += price[j] + 10 - (price[j] % 10)
    if sum <  min_sum:
        min_sum = sum
print(min_sum)

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

def deci(N):
    if N%10==0:
        return 10
    else:
        return N%10

def gauss(N):
    if N%10==0:
        return N
    else:
        return (N//10+1)*10

m=min(deci(A),deci(B),deci(C),deci(D),deci(E))

print(gauss(A)+gauss(B)+gauss(C)+gauss(D)+gauss(E)-10+m)

Solution (Python):
a = []
b = []
for i in range(5):
    n = int(input())
    if n % 10 == 0:
        b.append(10)
    else:
        b.append(n % 10)
    while n % 10 != 0:
        n = n + 1
    a.append(n)

print(a[0] + a[1] + a[2] + a[3] + a[4] - 10 + min(b))

Solution (Python):
a = [0] * 5
b = [0] * 5
for i in range(5):
    a[i] = int(input())
for i in range(5):
    if a[i] % 10 != 0:
        b[i] = a[i] % 10
    else:
        b[i] = 10
print(sum(a) - sum(b) + 50 - 10 + min(b))

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

data_list = [a,b,c,d,e]
least_number = 10
result = 0
for i in range (5):
    if int(str(data_list[i])[-1])<least_number and int(str(data_list[i])[-1])!=0:
        least_number = int(str(data_list[i])[-1])
    if int(str(data_list[i])[-1])==0:
        result += data_list[i]
    else:
        result += data_list[i] + 10 -int(str(data_list[i])[-1])

print(result + least_number -10)

Solution (Python):
import sys

def main():

    times = []

    for line in sys.stdin:
        line = line.rstrip()
        t = int(line)
        times.append(t)

    times.sort(key=lambda t: t % 10 if t % 10 != 0 else 10, reverse=True)

    
    

    s = 0
    for t in times[:-1]:
        new_t = t if t % 10 == 0 else (t // 10) * 10 + 10
        s += new_t

    s += times[-1]
    print(s)

    return 0

if __name__ == '__main__':
    sys.exit(main())

Solution (Python):
A = [int(input()) for _ in range(5)]
A.sort(key=lambda x: (x-1) % 10)
time = 0
for i, a in enumerate(reversed(A)):
    if a % 10 == 0 or i == 4:
        time += a
    else:
        time += a + 10 - (a % 10)
print(time)

Solution (Python):
import itertools

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

lp = []
for i in itertools.permutations(l):
    lp.append(i)

min_ = 10 ** 10


for lpi in lp:
    t = 0
    t += lpi[0]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x

    t += lpi[1]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x
    t += lpi[2]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x
    t += lpi[3]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x
    t += lpi[4]
    min_ = min(min_, t)

print(min_)

Solution (Python):
a = []
loss = 0
ans = 0
for i in range(5):
    a.append(int(input()))
    t = 10 - a[i] % 10
    if t != 10 and t > loss: loss = t
for i in range(5):
    ans += (a[i] + 9) // 10 * 10
print(ans - loss)

Solution (Python):
a = []

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


result = 0
min_min = 10
for each in a:
    if each % 10 != 0:
        result += each + 10 - (each % 10)
        if min_min > each % 10:
            min_min = each % 10
    else:
        result += each
print(result - (10 - min_min))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

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

tmp1 = [A, B, C, D, E]
tmp2 = [x%10 for x in tmp1]
min_=10 
index = None
for i in range(len(tmp2)):
	if tmp2[i] != 0:
		if tmp2[i] < min_:
			min_ = tmp2[i]
			index = i
for i in range(len(tmp1)):
	if i == index:
		continue
	if tmp1[i]%10 != 0:
		tmp1[i] = (tmp1[i] - tmp1[i]%10) + 10
print(sum(tmp1))

Solution (Python):
order = []

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

import numpy as np

order = np.array(order)

order_first = np.sort(((order-1) % 10))+1
order = ((order-1) // 10 + 1) * 10
print(order.sum() + order_first[0] - 10)

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

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

modMax, index = 0, 0
for i in range(5):
    if A[i]%10 != 0 and modMax < 10-A[i]%10:
        modMax = 10-A[i]%10
        index = i

ans = 0
for i in range(5):
    if i == index: ans += A[i]
    elif A[i]%10 != 0: ans += A[i] + 10-A[i]%10
    else: ans += A[i]

print( ans )

Solution (Python):
A=[]

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

m=10
s=10

for i in range(5):
    if A[i]%10<m and A[i]%10!=0:
        m=A[i]%10
        s=i

su=0

for i in range(5):
    if i==s:
        su+=A[i]
    elif A[i]%10!=0:
        su+=(A[i]//10+1)*10
    else:
        su+=A[i]
        
print(su)

Solution (Python):
a = [int(input()) for _ in range(5)]
cnt = []
ans = 0
for i in a:
    amari = (i%10)
    if amari != 0:
        cnt.append(amari)
        ans += i//10 + 1
    else:
        ans += i//10
        
ans *= 10
if len(cnt) != 0:
    ans -= 10
    ans += min(cnt)

print(ans)

Solution (Python):
import math

a = []
min_v = 10
min_i = 0
for i in range(5):
    v = int(input())
    a.append(v)

    r = v % 10
    if r < min_v and r > 0:
        min_v = r
        min_i = i

res = 0
for i in range(5):
    if i == min_i:
        res += a[i]
    else:
        res += math.ceil(a[i]/10)*10
        
print(res)

Solution (Python):


















import math
import copy
from collections import defaultdict, Counter

from itertools import product

from itertools import permutations

from itertools import combinations
from bisect import bisect_left, bisect_right


def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

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

ans = INF
for row in permutations(l, 5):
    t = 0
    for ind, i in enumerate(row):
        t += i
        if ind == 4:
            break
        for j in range(10):
            if (t + j) % 10 == 0:
                t += j
    if t<ans:
        ans = t

print(ans)

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

l=[a,b,c,d,e]
min=a
for x in l:
    y=x%10
    if y!=0:
        if y<(min%10):
            min=x
ans=min
k=0
for x in l:
    if k==0:
        if x==min:
            k+=1
        else:
            if x%10==0:
                ans+=x
            else:
                ans+=x-(x%10)+10
    else:
        if x%10==0:
            ans+=x
        else:
            ans+=x-(x%10)+10

print(ans)

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

pos, minn = 0, 10
for i, a in enumerate(A):
    if a % 10 < minn and a % 10 != 0:
        minn = a % 10
        pos = i

res = 0
for i, a in enumerate(A):
    if i == pos:
        res += a
    else:
        if a % 10 == 0:
            res += a
        else:
            res += a + (10 - (a % 10))
print(res)

Solution (Python):

l = []
ans = 0
rest = 10
for i in range(5):
    l.append(int(input()))
    if l[i] % 10 != 0:
        rest = min(rest, l[i] % 10)
for i in range(5):
    if l[i] % 10 != 0:
        ans += l[i] // 10 * 10 + 10
    else:
        ans += l[i]
print(ans + rest - 10)

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

Solution (Python):
time_list = [input() for _ in range(5)]
min_time = 10
for time in time_list:
    if time[-1]=="0":
        continue
    min_time = min(int(time[-1]), min_time)
ans = 0
for time in time_list:
    if time[-1]=="0":
        ans += int(time)
    else:
        ans += (int(time)//10 + 1)* 10
if min_time == 10:
    print(ans)
else:
    print(ans - (10-min_time))