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):
Lmin=[]
for i in range(5):
    Lmin.append(int(input()))
m=10
ans=0
for j in Lmin:
    ans+=(j//10)*10
    if j%10!=0:
        ans+=10
        if j%10<m:
            m=j%10
ans=ans-10+m
print(ans)

Solution (Python):

A=[]
B=[]
place=count=total=0

for i in range(5):
    A.append(input())
    place=A[i]
    total=total+int(A[i])
    if int(place[-1])!=0:
        B.append(int(place[-1]))
B.sort()
for j in range(1,len(B)):
    count=count+(10-B[j])

print(total+count)

Solution (Python):
from sys import stdin
from itertools import permutations 


def get_time(nums):
    time = 0
    for i, n in enumerate(nums):
        time = time + n
        if i < len(nums) - 1 and time % 10 != 0:
            time = time + (10 - time % 10)
    return time


def solve(nums):
    min_time = 0
    for p in permutations(nums, len(nums)):
        t = get_time(p)
        if min_time > t or min_time == 0:
            min_time = t
    return min_time

def main():
    nums = [int(l) for l in stdin.readlines()]
    ans = solve(nums)
    print(ans)

if __name__ == '__main__':
    main()

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

a = sum(list(map(lambda x: ((x-1)//10)*10+10, l)))

b = min(list(map(lambda x: (x-1)%10, l)))+1

print(a + b - 10)

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

num=[]
min=10
  
for list in time:
  if list%10==0:
    num.append(list)
  else:
    num.append(list+(10-list%10))
    if min>list%10:
      min=list%10

print(sum(num)-(10-min))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a%10,b%10,c%10,d%10,e%10]
lst.sort()
cnt = 0
for i in range(len(lst)):
  if lst[i] == 0:
    cnt += 1
if cnt == 5:
  print(a+b+c+d+e)
else:
  print((a//10+b//10+c//10+d//10+e//10+4-cnt)*10+lst[cnt])

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

Solution (Python):

import sys

def func_s2(x):
    t = x % 10
    if t == 0:
        return 10
    return t

def func_s3(x):
    am = x%10
    if am == 0:
        return x
    return x - am + 10

def solve(A: int, B: int, C: int, D: int, E: int):
    S1 = [A,B,C,D,E]
    S2 = list(map(func_s2,S1))
    S3 = list(map(func_s3,S1))
    min_S2 = min(S2)

    res = 0
    found_min = False
    for s1,s2,s3 in zip(S1,S2,S3):
        if not found_min and s2 == min_S2:
            found_min = True
            res += s1
        else:
            res += s3

    print(res)





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):
As = []
for i in range(5):
    x = int(input())
    if x%10 != 0:
        time_b = (x//10 + 1)*10
    else:
        time_b = (x//10 )*10

    amari  = x%10
    if amari == 0:
        amari = float('inf')
    As.append((amari, x, time_b))

As = sorted(As, key=lambda x:x[0])


sumed = sum([x[2] for x in As[1:] if x[2] != 0 ])

print(sumed + As[0][1])

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

zr = list(filter(lambda x: x % 10 == 0, n))
nz = list(filter(lambda x: x % 10 != 0, n))

nz.sort(key=lambda x: x % 10)

for i in range(1, len(nz)):
    nz[i] = 10 * (nz[i]//10+1)

print(sum(nz)+sum(zr))

Solution (Python):
list = []
timelist=[]
min_time = 10
for i in range(5):
    list.append(int(input()))
for i in list:
    if i%10 == 0:
        timelist.append(i)
    else:
        timelist.append((10-(i%10))+i)
        if i%10 < min_time:
            min_time = i%10
print(sum(timelist)-10+min_time)

Solution (Python):
l=[]
for i in range(5):
    l.append(int(input()))
indexn=10
indx=0
for v in range(5):
    if l[v]%10==0:
        pass
    else:
        if l[v]%10<indexn:
            indexn=l[v]%10
            indx=v
for k in range(5):
    l[k]=((l[k]-1)//10+1)*10
        
print(sum(l)-10+indexn)

Solution (Python):
import sys
a = [int(l) for l in sys.stdin]    

remainder = 9
target = 0
total = 0
for x in a:
  tmp = x % 10
  if tmp == 0:
    continue
  if remainder >= tmp:
    remainder = tmp
    target = x

for x in a:
  if x == target:
    total += target
    target = 0
  else:
    tmp = x % 10
    if tmp == 0:
      total += x
    else:
      total += 10 * (x // 10 + 1)

print(total)

Solution (Python):
import numpy as np
import math
import sys


def input():
    return sys.stdin.readline()[:-1]









a = [int(input()) for i in range(5)]
a = np.array(a)
b = np.ceil(a/10)*10
c = b-a
i = c.argmax()
print(int(np.sum(b)-b[i]+a[i]))

Solution (Python):
A = []
for _ in range(5):
    A.append(int(input()))
ans = sum([-10 * (-i//10) for i in A])
ans -= max([(10 - (i % 10)) % 10 for i in A])
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst_1 = sorted([(a - 1) % 10, (b - 1) % 10, (c - 1) % 10, (d - 1) % 10, (e - 1) % 10])
print(((a+9)//10)*10 + ((b+9)//10)*10 + ((c+9)//10)*10 + ((d+9)//10)*10 + ((e+9)//10)*10 - (10 - (lst_1[0] + 1) if lst_1[0] != 9 else 0))

Solution (Python):
l = [int(input()) for i in range(5)]
l2 = [0,0,0,0,0]
m = 0
s = 0
for i in range(5):
  l2[i] = (l[i]+9)//10*10
  m = max(m,l2[i]-l[i])
  s += l2[i]
print(s-m)

Solution (Python):
cooking = [int(input()) for _ in [0]*5]


sum_num = sum([(x+9)//10*10 for x in cooking])


min_num = min([x%10 if (x%10) else 10 for x in cooking])

print(sum_num + min_num - 10)

Solution (Python):
a = [int(input()) for i in range(5)]
b = [int(str(i)[-1]) for i in a.copy()]
c = []
d = []

for i in b:
  if i == 0:
    c.append(0)
  else:
    c.append(10 - i)
print(sum(a) + sum(c) - max(c))

Solution (Python):
from itertools import permutations

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

orders = list(permutations([A,B,C,D,E]))
ans = 999
for order in orders:
    tmp = 0
    for h,i in enumerate(order):
        tmp += i
        if h == 4:
            break
        if tmp % 10 != 0:
            tmp += 10 - (tmp % 10)
    if ans > tmp:
        ans = tmp
print(ans)

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

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

plus = 0

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

firstdigit = []

if a != 0:
    plus += 1
    firstdigit.append(a)
if b != 0:
    plus += 1
    firstdigit.append(b)
if c != 0:
    plus += 1
    firstdigit.append(c)
if d != 0:
    plus += 1
    firstdigit.append(d)
if e != 0:
    plus += 1
    firstdigit.append(e)
if plus > 0:
    plus -= 1

lastorder = 0
if firstdigit:
    lastorder = min(firstdigit)

sum = (A // 10) * 10 + (B // 10) * 10 + (C // 10) * 10 + (D // 10) * 10 + (E // 10) * 10 + plus * 10 + lastorder

print(int(sum))

Solution (Python):
'''input
101
86
119
108
57
'''

a=[]

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

flag=[]

for i in range(5):
	if a[i]%10!=0:
		flag.append(a[i]%10)
	else:
		flag.append(-1)


endInd=-1
end=float('inf')

for i in range(5):
	if flag[i]>0 and end>flag[i]:
		end=flag[i]
		endInd=i


if endInd==-1:
	print(sum(a))
else:
	s=a[endInd]
	
	a.pop(endInd)
	flag.pop(endInd)
	
	for i in range(4):
		if flag[i]>0:
			a[i]=(a[i]//10+1)*10
	
	s+=sum(a)
	print(s)

Solution (Python):
lossmax = 0
total = 0
for i in range(5):
    a = int(input())
    x = (a + 9) // 10 * 10
    total += x
    if lossmax < x - a:
        lossmax = x - a

total -= lossmax
print(total)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
	
a1 = a
b1 = b
c1 = c
d1 = d
e1 = e
	
a=(a+9)//10*10
b=(b+9)//10*10
c=(c+9)//10*10
d=(d+9)//10*10
e=(e+9)//10*10

a2 = a-a1
b2 = b-b1
c2 = c-c1
d2 = d-d1
e2 = e-e1

l=[a2,b2,c2,d2,e2]

x = (max(l))

print(a+b+c+d+e-x)

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

a1 = (a + 9) // 10 * 10
b1 = (b + 9) // 10 * 10
c1 = (c + 9) // 10 * 10
d1 = (d + 9) // 10 * 10
e1 = (e + 9) // 10 * 10

tmax = 0
if tmax < a1 - a:
    tmax = a1 - a
if tmax < b1 - b:
    tmax = b1 - b
if tmax < c1 - c:
    tmax = c1 - c
if tmax < d1 - d:
    tmax = d1 - d
if tmax < e1 - e:
    tmax = e1 - e

print(a1+b1+c1+d1+e1-tmax)

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

a1=(a+9)//10*10
b1=(b+9)//10*10
c1=(c+9)//10*10
d1=(d+9)//10*10
e1=(e+9)//10*10

tmax = 0
if tmax<a1-a:
	tmax=a1-a
if tmax<b1-b:
	tmax=b1-b
if tmax<c1-c:
	tmax=c1-c
if tmax<d1-d:
	tmax=d1-d
if tmax<e1-e:
	tmax=e1-e
	
print(a1+b1+c1+d1+e1-tmax)

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

a1 = (a +9) // 10 * 10
b1 = (b +9) // 10 * 10
c1 = (c +9) // 10 * 10
d1 = (d +9) // 10 * 10
e1 = (e +9) // 10 * 10

tmax = 0
if tmax < a1 - a:
    tmax = a1 - a
if tmax < b1 - b:
    tmax = b1 - b
if tmax < c1 - c:
    tmax = c1 - c
if tmax < d1 - d:
    tmax = d1 - d
if tmax < e1 - e:
    tmax = e1 - e



print(a1+b1+c1+d1+e1-tmax)

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

a1 = (a + 9) // 10 * 10
b1 = (b + 9) // 10 * 10
c1 = (c + 9) // 10 * 10
d1 = (d + 9) // 10 * 10
e1 = (e + 9) // 10 * 10

tmax = 0
if tmax < a1 - a:
	tmax = a1 - a
if tmax < b1 - b:
	tmax = b1 - b
if tmax < c1 - c:
	tmax = c1 - c
if tmax < d1 - d:
	tmax = d1 - d
if tmax < e1 - e:
	tmax = e1 - e

print(a1+b1+c1+d1+e1-tmax)

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

a1=(a+9)//10*10
b1=(b+9)//10*10
c1=(c+9)//10*10
d1=(d+9)//10*10
e1=(e+9)//10*10

tmax=0
if tmax<a1-a:
	tmax=a1-a
if tmax<b1-b:
	tmax=b1-b
if tmax<c1-c:
	tmax=c1-c
if tmax<d1-d:
	tmax=d1-d
if tmax<e1-e:
	tmax=e1-e

print(a1+b1+c1+d1+e1-tmax)

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

a1 = (a + 9) //10 * 10
b1 = (b + 9) //10 * 10
c1 = (c + 9) //10 * 10
d1 = (d + 9) //10 * 10
e1 = (e + 9) //10 * 10

tmax = 0
if tmax < a1 - a:
	tmax =a1 - a
if tmax < b1 - b:
	tmax =b1 - b
if tmax < c1 - c:
	tmax =c1 - c
if tmax < d1 - d:
	tmax =d1 - d
if tmax < e1 - e:
	tmax =e1 - e
print(a1+b1+c1+d1+e1-tmax)

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

a1 = (a + 9) // 10 * 10
b1 = (b + 9) // 10 * 10
c1 = (c + 9) // 10 * 10
d1 = (d + 9) // 10 * 10
e1 = (e + 9) // 10 * 10

tmax = 0
if tmax < a1 -a:
    tmax = a1 -a
if tmax < b1 -b:
    tmax = b1 -b
if tmax < c1 -c:
    tmax = c1 -c
if tmax < d1 -d:
    tmax = d1 -d
if tmax < e1 -e:
    tmax = e1 -e
    
print(a1+b1+c1+d1+e1-tmax)

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

a1 = (a + 9) // 10 * 10
b1 = (b + 9) // 10 * 10
c1 = (c + 9) // 10 * 10
d1 = (d + 9) // 10 * 10
e1 = (e + 9) // 10 * 10

tmax = 0
if tmax < a1 - a:
	tmax = a1 - a
if tmax < b1 - b:
	tmax = b1 - b
if tmax < c1 - c:
	tmax = c1 - c
if tmax < d1 - d:
	tmax = d1 - d
if tmax < e1 - e:
	tmax = e1 - e

print(a1+b1+c1+d1+e1-tmax)

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

a1=(a+9)//10*10
b1=(b+9)//10*10
c1=(c+9)//10*10
d1=(d+9)//10*10
e1=(e+9)//10*10

tmax=0
if tmax<a1-a:
	tmax=a1-a
if tmax<b1-b:
	tmax=b1-b
if tmax<c1-c:
	tmax=c1-c
if tmax<d1-d:
	tmax=d1-d
if tmax<e1-e:
	tmax=e1-e

print (a1+b1+c1+d1+e1-tmax)

Solution (Python):
ans = 0
x = []
for i in range(5):
	a = int(input())
	ans += int(a // 10) * 10
	x.append(a % 10)

x = sorted(x)
for i in range(5):
	if x[i] != 0:
		ans += (4 - i) * 10 + x[i]
		break
print(ans)

Solution (Python):
s = 0
num = 10
for i in range(5):
    k = int(input())
    l = k - 10*int(k/10)
    if 1<=l<num:
        num = l
    if l==0:
        l = 10
    s+=k-l+10
print(s-10+num)

Solution (Python):
a,b,c,d,e = [int(input()) for i in range(5)]
count = a + b + c + d + e
l = [a%10,b%10,c%10,d%10,e%10]
s = [a%10,b%10,c%10,d%10,e%10]
m = [a%10,b%10,c%10,d%10,e%10]
for x in range(len(l)):
    if l[x] == 0:
        m.remove(0)
for i in range (len(s)):
    count = count -s[i]
if len(m) == 0:
    ans= count
    print(ans)
else:
    ans = count + 10*len(m) + min(m) -10
    print(ans)

Solution (Python):
l=[int(input()) for _ in [0]*5]
print(sum([(x+9)//10*10 for x in l])+min([x%10 if (x%10) else 10 for x in l])-10)

Solution (Python):
l=[int(input()) for _ in [0]*5]
n=[10-x%10 if x%10 else 0 for x in l]
m=min([x%10 if x%10 else 10 for x in l])
print(sum(l+n)+(m-10 if (m) else 0))

Solution (Python):
l = [int(input()) for _ in range(5)]
n = [10-l[x]%10 if (l[x]%10) else 0 for x in range(5)]
m = min([l[x]%10 if (l[x]%10) else 10 for x in range(5)])
print(sum(l+n)+(m-10 if (m) else 0))

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

"""
B - Five Dishes
https://atcoder.jp/contests/abc123/tasks/abc123_b

"""
import sys


def solve(dishes):
    dishes = sorted(dishes, key=lambda x: [10, 1, 2, 3, 4, 5, 6, 7, 8, 9][x%10])
    ans = dishes[0]
    for d in dishes[1:]:
        ans += (d+9) // 10 * 10
    return ans


def main(args):
    dishes = [int(input()) for _ in range(5)]
    ans = solve(dishes)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
a=[int(input()) for _ in range(5)]
t=[x%10 if x%10!=0 else 10 for x in a]
idx=t.index(min(t))
m=a[idx]
a.remove(m)
a=[(x//10+int(bool(x%10)))*10 for x in a]
print(sum(a)+m)

Solution (Python):
sums = 0
k = []
for i in range(5):
  g = int(input())
  if g%10 != 0:
      sums += g + 10 - g%10
      k.append(g%10)
  else:
      sums += g
      k.append(11)
j = min(k)
if j != 11:
    print(sums - 10 + j)
else:
    print(sums)

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

for i in a:
  x = i % 10
  if (x != 0) & (x < low % 10):
    low = i
  
a.remove(low)
a.append(low)

o = [-(i // -10) * 10 for i in a]
o[4] = ((a[4] // 10) * 10) + (a[4] % 10)

print(sum(o))

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

sum = 0
m = 10
for i in l:
    if (i % 10 == 0):
        sum += i
    else:
        sum += i + 10 - (i % 10)
        if (i % 10 < m):
            m = i % 10

print(sum - 10 + m)

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

minutes = 0
items = [A, B, C, D, E]
rems = [item % 10 for item in items if item % 10 != 0]
cnt = len(rems)


for item in items:
    minutes += (item//10)*10
 
if cnt > 0:
    minutes += (cnt-1)*10
    minutes += min(rems)

print(minutes)

Solution (Python):
import math
min = 10
sum = 0
for i in range(5):
  a = int(input())
  sum += math.ceil(a / 10) * 10
  rem = (a-1) % 10 + 1
  if rem < min:
    min = rem

print(sum + min - 10)

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






def ofooo(n):
    return int(round(n+4.9, -1))

m=0
res = 0
for n in a:
    aa = ofooo(n)
    res += aa
    if m < aa-n:
        m = aa-n
print(res - m)

Solution (Python):
dishes = [int(input()) for i in range(0, 5)]

maxloss = 0
maxlossidx = 0
loss = 0
for i in range(0, 5):
    loss = 10 - int(str(dishes[i])[-1:])
    if loss < 10 and  loss > maxloss :
        maxloss = loss
        maxlossidx = i

last = dishes[maxlossidx]
del dishes[maxlossidx]

work = 0
for i in range(0,4):
    if dishes[i] % 10 != 0:
        dishes[i] += 10 - int(str(dishes[i])[-1:])

    work += dishes[i]

print(work + last)

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

def ten(min):
    return min + 10-min%10

fds.sort(key=lambda x: x%10)

sum = 0
a = False
for i in range(5):
    if fds[i]%10 == 0:
        sum += fds[i]
    elif a:
        sum += ten(fds[i])
    else:
        sum += fds[i]
        a = True

print(sum)

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

for i in range(len(l)):
    if l[i] % 10 != 0:
        sur[i] = 10 - (l[i]%10)

ans = sum(l) + sum(sur) - max(sur)
print(ans)

Solution (Python):
l = []
for _ in range(5):
    a = int(input())
    b = 10 - a % 10
    if b == 10:
        b = 0
    l.append([a, b])

m = 0
r = 0
total = 0
for a, b in l:
    if b > r:
        m = a
        r = b
    elif b == r and a < m:
        m = a
        r = b
    total += a + b

print(total - r)

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

cnt0 = 0

a0 = a%10
if a0 == 0:
    cnt0 += 1
b0 = b%10
if b0 == 0:
    cnt0 += 1
c0 = c%10
if c0 == 0:
    cnt0 += 1
d0 = d%10
if d0 == 0:
    cnt0 += 1
e0 = e%10
if e0 == 0:
    cnt0 += 1

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

cnt1 = (a1+b1+c1+d1+e1)*10

if cnt0 == 4 or cnt0 ==5:
    print(a+b+c+d+e)
else:
    A = [a0,b0,c0,d0,e0]
    A.sort()
    print(cnt1 + (5-cnt0-1)*10 + A[cnt0])

Solution (Python):
l = [int(input())for i in range(5)]
l1 = ['']*5
ans = 0
for i in range(5):
    l1[i] = l[i]%10
    if l1[i] == 0:
        l1[i] = 10
for i in range(5):
    ans += -(-l[i]//10)
print(ans*10 - 10 + min(l1))

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

ans = 1000
for i in range(5):
    tmp = 0
    for j in range(5):
        if i==j:
            tmp += T[j]
        else:
            tmp += T[j] + (-T[j])%10
    ans = min(tmp,ans)
print(ans)

Solution (Python):
list = [int(input()) for _ in range(5)]
list10 = [i+(10-i)%10 for i in list]
sum_list10 = sum(list10)

min_sum = sum_list10
for i in range(5):
  sum = sum_list10-list10[i]+list[i]
  if sum < min_sum:
    min_sum = sum
    
print(min_sum)

Solution (Python):
import math

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


def R(n):
    return (10 - n % 10) % 10


def S(n):
    if n % 10 == 0:
        return n
    return (1 + n // 10) * 10


Sum = sum(map(S, [a, b, c, d, e]))
Max = max(map(R, [a, b, c, d, e]))

print(Sum - Max)

Solution (Python):
food_list = []
for i in range(5):
    food_list.append(str(int(input())-1))
food_list = sorted(food_list, key=lambda x: x[-1], reverse=True)
food_list = [int(i) + 1 for i in food_list]
count = 0
for i in food_list[:-1]:
    count += i + (10 -i % 10) % 10
count += food_list[-1]
print(count)

Solution (Python):


t = [int]*5
amari = [int]*5

for i in range(5):
	t[i] = int(input())
	amari[i] = t[i]%10
	amari[i] = int(str(10-amari[i])[-1:])

ind = amari.index(max(amari))
time = t[ind]

for i in range(5):
	if i != ind:
		time += t[i] + amari[i]

print(time)

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

res = l[-1]
for i in range(4):
	res += (l[i] + 9) // 10 * 10
print(res)

Solution (Python):
lst = []
total = 0
for i in range(5):
    n = int(input())
    lst.append([(n-1) % 10, n])
lst.sort()

for i in range(len(lst)):
    if i == 0:
        total += lst[i][1]
    else:
        total += ((lst[i][1] + 9) // 10) * 10
print(total)

Solution (Python):
lst = []
for i in range(5):
  n = int(input())
  lst.append([(n - 1) % 10, n])
lst = sorted(lst)

res = 0
for i in range(5):
  if i == 0:
    res += lst[i][1]
  else:
    res += (lst[i][1] + 9) // 10 * 10
print(res)

Solution (Python):
m = 10
x = 0

for i in range(5):
	n = int(input())
	if n%10 == 0:
		x += n
		continue
	elif n%10 < m:
		m = n%10
	x += n - n%10 +10
	
print(x -10 + m)

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

for i in range(len(dishes)):
    if i == len(dishes) - 1:
        res += dishes[i]
    elif dishes[i] % 10 != 0:
        res += (dishes[i] // 10 + 1) * 10
    else:
        res += dishes[i]

print(res)

Solution (Python):
import math

num_0 = list()
for ii in range(5):
    num_0.append(int(input()))

num_1 = list(range(5))
for ii in range(5):
    num_1[ii] = 10 * math.ceil(num_0[ii]/10)
   
num_2 = list(range(5))
for ii in range(5):
    num_2[ii] = num_1[ii] - num_0[ii]
    
num = max(num_2)
    
print(sum(num_1) - num)

Solution (Python):
import numpy as np
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

l=np.array([A,B,C,D,E])

print(sum(-(-l//10))*10+min((l-1)%10+1)-10)

Solution (Python):
A=[int(input()) for _ in range(5)]
B=[((i-1)//10+1)*10 for i in A]
c=min([A[i]-B[i] for i in range(5)])
print(sum(B)+c)

Solution (Python):
import math
b=[]
c=[]
d=9
e=0
f=0
g=0
for i in range(5):
    a=int(input())
    b.append(a)
    c.append(int(str(a)[-1]))
for u in range(5):
    if c[u] < d and c[u] > 0:
        d=c[u]
        e=u
f=b[e]
b.pop(e)
for u in b:
    g += math.ceil(u/10)*10
print(g+f)

Solution (Python):
import math

list=list((int(input()) for i in range(5)))
min=10
index=0
result=0
for i in range(len(list)):
    if min > list[i]%10 and list[i]%10 !=0:
        min=list[i]%10
        index=i
for i in range(len(list)):
    if i != index:
        result+=math.ceil(list[i]/10)*10
result+=list[index]
print(result)

Solution (Python):
ans = 0
loss = 0
for i in range(5):
    x = int(input())
    if x%10 != 0:
        loss = max(loss, 10-x%10)
    ans += (x+9)//10*10
print(ans - loss)

Solution (Python):
menus = list(map(lambda x: (x - x % 10, x % 10), [int(input()) for _ in range(5)]))
tens = [ i[0] for i in menus ]
mods = sorted(list(filter(lambda x: x != 0, [ i[1] for i in menus])))
print(sum(tens) + ((mods[0]+ 10*(len(mods) - 1))if len(mods) > 0 else 0))

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

min = 10
min_index = 0
time = 0

data = []

data.append(a)
data.append(b)
data.append(c)
data.append(d)
data.append(e)

for i in range(0, 5):
	if data[i] % 10 < min and data[i] % 10 > 0:
		min = data[i] % 10
		min_index = i
for i in range(0, 5):
	if i == min_index:
		continue
	if data[i] % 10 == 0:
		time += data[i]
	else:
		time += ((int(data[i] / 10) + 1) * 10)
	
print(time + data[min_index])

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dishes = [a,b,c,d,e]
n = []
ans = 0
for i in range(5):
  if dishes[i]%10==0:
    ans += dishes[i]//10
  else:
    ans += dishes[i]//10+1
    n.append(dishes[i]%10)
if len(n)==0:
  print(ans*10)
else:
  ans = ans*10-10+min(n)
  print(ans)

Solution (Python):
m = 10
 
wa = 0
 
for i in range(5):
  n = int(input())
  if n%10 is 0:
    wa += n
    continue
  if n%10 < m:
    m = n%10
  wa += n- n%10 +10
    
print(wa-10+m)

Solution (Python):
from math import ceil

abcde = []
for _ in range(5):
    abcde.append(int(input()))

result = 0
min_1  = None
for i in abcde:
    
    result += ceil(i/10)*10
    if i%10 != 0:
        if min_1 == None:
            min_1 = i%10
        else:
            min_1 = min(min_1,i%10)



if min_1:
    result -= 10 - min_1

print(result)

Solution (Python):
l=[int(input()) for i in range(5)]
m=list(map(lambda x:(x-1)%10,l))
n=m.index(min(m))
o=list(map(lambda x:((x-1)//10)*10+10,l))
o.pop(n)
print(sum(o)+l[n])

Solution (Python):


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


def calc(N):
    r = N % 10
    if r == 0:
        r = 10
    count = N + 10 - r
    return r, count


set_list = [a, b, c, d, e]
remainder_list = [0] * 5
counts = [0] * 5

for i in range(5):
    r, count = calc(set_list[i])
    remainder_list[i] = r
    counts[i] = count

print(sum(counts) + min(remainder_list) - 10)

Solution (Python):
import itertools
import queue
l = [int(input()) for i in range(5)]
q = queue.Queue()
f = 123*5 + 60
for v in itertools.permutations(l, 5):
    for a in v:
        q.put(a)

    t = q.get()
    for i in range(0, 123*5 + 60):
        if t == 0 and q.empty():
            if i <= f:
                f = i
            break
        elif t == 0 and i % 10 == 0:
            t = q.get()
            t = t - 1
        elif t > 0:
            t = t - 1
print(f)

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

start = 0 
amari = []
shou = []
for i in range(5) :
    if input_val[i] % 10 == 0 :
        amari.append(10)
        shou.append(input_val[i] - 10)
    else :
        amari.append(input_val[i]%10)
        shou.append(input_val[i] - input_val[i]%10)

amari.sort()
loss = [(10 - i) for i in amari]
start += sum(shou)
for i in range(5):
    start += loss[i] + amari[i]

start -= loss[0]

print(start)

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

ans, remainder = 0, 10
for t in T:
    if t % 10 != 0:
        ans += (t // 10) * 10 + 10
        remainder = min(t % 10, remainder)
    else:
        ans += t
print(ans + remainder - 10)

Solution (Python):



def main():
    costs = [int(input()) for _ in range(5)]
    mods = [cost % 10 for cost in costs if cost % 10 != 0]

    real_cost = []
    for cost in costs:
        if cost % 10 != 0:
            real_cost.append(cost + 10 - (cost % 10))
        else:
            real_cost.append(cost)
    total = sum(real_cost)
    if len(mods) != 0:
        min_mod = min(mods)
        print(total - (10 - min_mod))
    else:
        print(total)


if __name__ == '__main__':
    main()

Solution (Python):
import math

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

def minus(x):
    return 0 if x == 0 else 10 - x

aaa = list(map(lambda x: math.ceil(x/10)*10, order))
bbb = list(map(lambda x: x%10,order))

print(sum(aaa) - max(map(minus,bbb)))

Solution (Python):
def main():
  t_list = []
  for i in range(5):
    t_list.append(int(input()))
  t_list = sorted(t_list, key=lambda x: (x + 9) % 10)[::-1]
  time = 0
  for i in range(4):
    time += 10 * ((t_list[i] + 9) // 10)
  time += t_list[4]
  print(time)


if __name__ == "__main__":
  main()

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
if A % 10 == 0:
	aw = A
else:
	aw = int(A/10)*10 + 10
if B % 10 == 0:
	bw = B
else:
	bw = int(B/10)*10 + 10
if C % 10 == 0:
	cw = C
else:
	cw = int(C/10)*10 + 10
if D % 10 == 0:
	dw = D
else:
	dw = int(D/10)*10 + 10
if E % 10 == 0:
	ew = E
else:
	ew = int(E/10)*10 + 10
V1 = [A,B,C,D,E]
V2 = [aw,bw,cw,dw,ew]
V3 = [V2[j] - V1[j] for j in range(0,5)]
mx = V3.index(max(V3))
print(aw + bw + cw + dw + ew - V2[mx] + V1[mx])

Solution (Python):
l = [int(input())for i in range(5)]
ans = 0
amari = []
for i in l:
    amari.append(i%10)
amamari = []
for j in amari:
    if j == 0:
        amamari.append(0)
    else:
        amamari.append(10-j)    
amarii = sorted(amamari)
sumsum = sum(l)
sumsumamari = sum(amarii[:4])
ans = sumsum+sumsumamari
print(ans)

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

for time in cooking_times:
    if time % 10 == 0:
        result += time
    else:
        result += time - time % 10
        fractional_times.append(time % 10)

if fractional_times != []:
    result += (len(fractional_times) - 1) * 10
    result += min(fractional_times)

print(result)

Solution (Python):
a, b, c, d, e = list(int(input()) for i in range(5))

round = []
edge = []

for i in (a, b, c, d, e):
    if i % 10 == 0:
        round.append(0)
    else:
        edge.append(i % 10)

if len(edge) != 0:
    m = min(edge)
else:
    m = 10

ans = 0
for i in (a, b, c, d, e):
    ans += (i - 1) // 10 + 1

ans *= 10
ans -= (10 - m)
print(ans)

Solution (Python):
meal=list(int(input()) for _ in range(5))
meal_t=[(10-tmp%10)%10 for tmp in meal]
print(sum(meal)+sum(meal_t)-max(meal_t))

Solution (Python):
from decimal import Decimal, ROUND_UP
 
l = [int(input()) for _ in range(5)]
if len([x%10 for x in l if x%10 > 0]) > 0:
    min_remainder = 10 - min([x%10 for x in l if x%10 > 0])
    print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]) - min_remainder)
else:
    print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]))

Solution (Python):
import math

List = list(map(int, [input() for _ in range(5)]))
List_t = list(map(lambda x: math.ceil(x / 10) * 10, List))

ans = sum(List_t)
for i in range(5):
    s = sum(List_t[:i]) + sum(List_t[i+1:]) + List[i]
    if s < ans:
        ans = s

print(ans)

Solution (Python):
import math
lists=list(int(input()) for i in range(5))
modlists=list(lists[j]%10 for j in range(5))
x=set(modlists)
if 0 in x :
      x.remove(0)

      
else:
      x=set(modlists)
            

k=modlists.index(min(x)) if x else 0


b=0
for m in range(5):
      b+=math.ceil(lists[m]/10)*10
print(b-math.ceil(lists[k]/10)*10+lists[k])