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

menu = []
score = 0
ans = 0
for i in range(5):
    m = int(input())
    score = m % 10
    if score == 0:
        score = 10
    menu.append([m, score])

menu.sort(key=lambda x: x[1], reverse=True)

for i in range(5):
    if i < 4:
        tmp = math.ceil(menu[i][0] / 10) * 10
    else:
        tmp = menu[i][0]
    ans += int(tmp)
print(ans)

Solution (Python):
dish = list(int(input()) for _ in range(5))

res = 0
s = 0
for i in dish:
    i %= 10
    if i != 0:
        res = max(res, 10 - i)
        s += 10 - i

print(sum(dish) + s - res)

Solution (Python):
time = 0
dishes = [int(input()) for _ in range(5)]
lead_times = [0] * 5
long_time = 0
last_dish = 0

for i in range(5):
    lead_times[i] = (10 - (dishes[i] % 10)) % 10
    if lead_times[i] > long_time:
        last_dish = i
        long_time = lead_times[i]

for i in range(5):
    time += dishes[i]
    if i != last_dish:
        time += lead_times[i]

print(time)

Solution (Python):
dish = list(int(input()) for _ in range(5))

res = 0
s = 0
for i in dish:
    i %= 10
    if i != 0:
        res = max(res, 10 - i)
        s += 10 - i

print(sum(dish) + s - res)

Solution (Python):
l = [int(input()) for _ in range(5)]
m = [10 * ((l[i] + 9) // 10) for i in range(5)]
t = 130 * 5
for i in range(5):
    u = sum(m) - m[i] + l[i]
    t = min(t, u)
print(t)

Solution (Python):
a = [0]*5
m = [0]*5
def gobi(n):
    return int(str(n)[-1])
def wait(n):
    if n == 0:
        return 0
    else:
        return 10-n
for i in range(5):
    a[i] = int(input())
for i in range(5):
    m[i] = wait(gobi(a[i]))
print(sum(a)+sum(m)-max(m))

Solution (Python):
x=[0]*5
k=0
for i in range(5):
	x[i]=int(input())
for i in range(5):
	if (10-(x[i]%10))>k and x[i]%10!=0:
		k=(10-(x[i]%10))
for i in range(5):
	x[i]=(-(-x[i]//10))*10
print(round(sum(x)-k))

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

for i in range(5):
    a = list_N[i]
    a.append(list_N[i][0]%10)

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

ans = 0
j = 0
for i in range(5):
    a = list_N[i]
    if a[1] == 0:
        ans += a[0]
        j = i+1

if j != 5:
    for i in range(j, 5):
        a = list_N[i]
        if i == j:
            ans += a[0]
        else:
            ans += a[0] + 10 - a[1]

print(ans)

Solution (Python):
a,*t=map(int,open(0));c=0
for t in t:
  b=a+t;a=a*(0<a%10<t%10 or t%10<1)or t
  b-=a;c+=b+(10-b%10)*(b%10>0)
print(c+a)

Solution (Python):
l =list(int(input()) for i in range(5))
a =[]
time = 0
for i in range(5):
  if l[i]%10!=0:
    a.append(l[i]%10)
  else:
    a.append(9)

b = a.index(min(a))

for i in range(5):
  time += (-(-l[i]//10))*10
  
time -= (-(-l[b]//10)*10) - l[b]
print(time)

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

srv_t = 0
last_srv = 0

for d in D:
   if d%10!=0:
       t = 10 - d%10
   else:
       t = 0
    
   srv_t += (d+t)
    
   last_srv = max(last_srv,t)
    
print(srv_t-last_srv)

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

l=list([a,b,c,d,e])
sum=99999
for v in itertools.permutations(l):
    s1=0
    for i in range(0,len(v)-1):
        d=v[i]
        if d%10!=0:
            d+=10-(d%10)
        s1+=d
    s1+=v[-1]    
    sum=min(s1,sum)
print(sum)

Solution (Python):
import sys
import os
import math


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    TIMES = [int(sys.stdin.readline().rstrip()) for _ in range(5)]

    ret = 0
    tmp = -1
    for time in TIMES:
        t = math.ceil(time / 10) * 10
        ret += t
        if tmp < t - time: tmp = t - time

    print(ret - tmp)


if __name__ == '__main__':
    main()

Solution (Python):
A = [int(input()) for i in range(5)]
cnt = 0
res = 0
for i in A:
  cnt += (i + 9)//10
  res = max(res,(10 - i % 10)%10)

print(cnt*10-res)

Solution (Python):
import math
orders = [int(input()) for i in range(5)]
maximum,total = 0,0
for order in orders:
    time = math.ceil(order/10)*10
    total += time
    remain = time - order
    maximum = max(maximum,remain)
print(total-maximum)

Solution (Python):
from math import ceil
A = [int(input()) for _ in range(5)]
A.sort(key=lambda a: -a % 10)
total = 0
for i in range(4):
  total += ceil(A[i] / 10) * 10
total += A[-1]
print(total)

Solution (Python):
import numpy as np


def my_round(val, digit=0):
    p = 10 ** digit
    return np.ceil((val * p * 2 + 1)) // 2 / p


def main():
    dishes = [input() for _ in range(5)]
    first_digit = float("inf")
    order_dishies = []
    for i in range(5):
        if int(dishes[i][-1]) == 0:
            order_dishies.insert(0, i)
        else:
            first_digit = min(int(dishes[i][-1]), first_digit)
            if first_digit == int(dishes[i][-1]):
                order_dishies.append(i)
            else:
                order_dishies.insert(0, i)
    ans = 0
    for i in range(5):
        if i == 4:
            ans += int(dishes[order_dishies[i]])
        else:
            ans += my_round(int(dishes[order_dishies[i]]), -1)
    print(int(ans))


if __name__ == "__main__":
    main()

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

ans=0
first=10

for i in range(5):
    ans-=(-A[i]//10)*10
    if A[i]%10>0 and A[i]%10<first:
        first=A[i]%10

if first!=0:
    ans-=(10-first)

print(ans)

Solution (Python):
a = [int(input()) for _ in range(5)]
aa = [-(-x//10*10) for x in a]
b = [x-y for x, y in zip(aa, a)]
ans = sum(aa)-max(b)
print(ans)

Solution (Python):
import numpy as np

a = np.array([int(input()) for _ in range(5)])
aa = np.array(list(map(lambda x: -(-x//10*10), a)))
b = aa-a
ans = sum(aa)-max(b)
print(ans)

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

from itertools import permutations

Z = list(range(5))

Z = list(permutations(Z))

ans = float("inf")
for z in Z:
    time = 0
    for i,x in enumerate(z):
        time += A[x]
        if i == 4:
            break
        while time % 10 != 0:
            time += 1
    ans = min(ans, time)

print(ans)

Solution (Python):
a=sorted(list(map(int,[input()for i in range(5)])),key=lambda x:x%10)
if ''.join([str(i)[-1]for i in a])=='00000':print(sum(a));quit()
while str(a[0])[-1]=='0':
  a+=[a[0]]
  del a[0]
print(sum([a[0]]+[10*(0--i//10)for i in a[1:]]))

Solution (Python):
a=[int(input())for _ in range(5)]
x=[10*(0--i//10)for i in a]
print(sum(x)-max(x[i]-a[i]for i in range(5)))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]

last = -1
amari = 10
tmp = -1
for i in range(5):
    if ls[i] %10 != 0:
        if amari > ls[i] % 10:
            amari = ls[i] % 10
            tmp = i
        ls[i] += 10 -ls[i] % 10

print(sum(ls)-(10-amari))

Solution (Python):


def judge_last(x):
    if x % 10 != 0 and last > x % 10:
        return x % 10
    return last

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

last = judge_last(a)
last = judge_last(b)
last = judge_last(c)
last = judge_last(d)
last = judge_last(e)

a = -(-a // 10) * 10
b = -(-b // 10) * 10 
c = -(-c // 10) * 10
d = -(-d // 10) * 10 
e = -(-e // 10) * 10
print(a + b + c + d + e - 10 + last)

Solution (Python):
a=input()
b=input()
c=input()
d=input()
e=input()
p=0
s=[a,b,c,d,e]
s = [int(n) for n in s]
l=10
m=[a[-1],b[-1],c[-1],d[-1],e[-1]]
for i in range(5):
    if int(m[i][-1])!=0 and l>int(m[i]):
        l=int(m[i][-1])
for i in range(5):
    while s[i]%10!=0:
        s[i]+=1
        p+=1
print(sum(s)-10+l)

Solution (Python):
ans=10**20
a=[int(input())for _ in range(5)]
b=[10*(0--i//10) for i in a]
for i in range(5):
  ans=min(ans,sum(b)-b[i]+a[i])
print(ans)

Solution (Python):
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Solution (Python):
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')
def Z(f):
    if f:
        print('Yay!')
    else:
        print(':(')
def ispow(n):
    if int(n**.5)**2==n:
        return True
    return False

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

res = 10 ** 100
for p in perm(list(range(5))):
    cur = 0
    for i in p:
        cur = (cur + 9) // 10 * 10
        cur += l[i]
    res = min(res, cur)
print(res)

Solution (Python):
import itertools
import math
s = [int(input()) for i in range(5)]
mn = 644
for i in itertools.permutations(s):
	v = 0
	for k, j in enumerate(i):
		if k != 4:
			v += math.ceil(j/10)*10
		else:
			v += j
	mn = min(mn, v)
print (mn)

Solution (Python):
from itertools import permutations

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

minT = 10000
for sample in permutations(dishes, 5):
    t = 0
    for dish in sample:
        if t%10 != 0:
            t += 10 - t%10
        t += dish
    minT = min(minT, t)
print(minT)

Solution (Python):
import math
def main(t):
    lastIndex = 0
    minVal = 2**31-1
    for i,val in enumerate(t):
        mod = int(val%10)
        if mod != 0 and mod < minVal:
            minVal = mod
            lastIndex = i
    res = 0
    for i in range(len(t)):
        if i == lastIndex:
            continue
        res += math.ceil(t[i]/10)*10
    res += t[lastIndex]
    return int(res)

t = [int(input()) for _ in range(5)]
print(main(t))

Solution (Python):


a = [int(input()) for _ in range(5)]
b = [a[i] // 10 for i in range(5)]
c = [10] + sorted([a[i] % 10 for i in range(5) if a[i] % 10 != 0])

s = 10 * sum(b) + (len(c)-2) * 10 + min(c)

print(s)

Solution (Python):
import itertools

arr = [0] * 5
for i in range(5):
    arr[i] = int(input())

total = []
for v in itertools.permutations(arr, 5):
    s = 0
    for i in range(4):
        if v[i] % 10 == 0:
            s += v[i]
        else:
            s += (v[i] // 10) * 10 + 10
    s += v[4]
    total.append(s)

print(min(total))

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

ans = 0
modmin = 10

for d in dish:
    ans += (d + 10 - 1) // 10
    if d % 10 != 0:
        modmin = min(modmin, d % 10)

print(ans * 10 - (10 - modmin))

Solution (Python):
def calc(x):
    if x%10!=0:
        y=x+(10-x%10)
    else:
        y=x
    return y

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

a_ = calc(a)
b_ = calc(b)
c_ = calc(c)
d_ = calc(d)
e_ = calc(e)



l=[a+b_+c_+d_+e_, a_+b+c_+d_+e_, a_+b_+c+d_+e_, a_+b_+c_+d+e_, a_+b_+c_+d_+e]
print(min(l))

Solution (Python):
A=[int(input()) for i in range(5)]
ans=0
for i in range(5):
    if A[i]%10==0:
        ans+=A[i]
        A[i]=0
B=[str(i) for i in A]
C=[B[i][-1] for i in range(5)]
C=[int(C[i]) for i in range(5)]
D=[None]*5
for i in range(5):
    D[i]=int(B[i])-int(C[i])
E=list([n for n in(sorted(C,reverse=True)) if n>0])
for i in range(len(E)-1):
    ans+=10
try:
    ans=ans+E[-1]+int(sum(D))
except(IndexError):
    ans=ans+int(sum(D))
print(ans)

Solution (Python):
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Solution (Python):
import math
A = [int(input()) for i in range(5)]
Aa = [i for i in A if i % 10 == 0]
Ab = [i for i in A if not i % 10 == 0]
Ab = sorted(Ab, key=lambda x : (x) % 10, reverse=True)


total = 0
for i in range(len(Aa)):
  total += math.ceil(Aa[i] / 10) * 10
  
for i in range(len(Ab)):
  if i +1 == len(Ab):
  	total += Ab[i]
  else:
  	total += math.ceil(Ab[i] / 10) * 10
  
  
print(total)

Solution (Python):
from math import ceil
A = [int(input()) for _ in range(5)]
A = sorted(A, key=lambda x:x%10)
B = list(map(lambda x: 10*ceil(x/10), A))
C = [0]*5
for i in range(5):
  C[i] = B[i] - A[i]
max_c = max(C)
print(sum(B)-max_c)

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

last = -1
for i in range(5):
  if a[i] % 10 != 0:
    last = i
  break

if last == -1:
  last = 0
else:
  for i in range(5):
    if a[i] % 10 < a[last] % 10 and a[i] % 10 != 0:
      last = i


ans = 0
for i in range(5):
  if i == last:
    continue

  ans += a[i]
  if ans % 10 != 0:
    ans += 10 - (a[i] % 10)

ans += a[last]

print(ans)

Solution (Python):
lis=[]
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
ans=0
lis_h=[]
for i in range(5):
        hito=int(str(lis[i])[-1])
        time=lis[i]
        if hito==0:
                ans+=time
        else:
                lis_h.append([hito,time])
lis_h.sort()

if len(lis_h)==0:
        print(ans)
        exit()
ans+=lis_h[0][1]

for i in range(len(lis_h)):
        if i==0:
                continue
        num = (lis_h[i][1]//10) * 10
        if lis_h[i][0] != 0:
                num+=10
        ans+=num

print(ans)

Solution (Python):


dish = [int(input().rstrip()) for i in range(5)]


def get_ans(flag: int, current: int):
    if (1 << 5) - 1 == flag:
        return current

    tmp = current
    if current % 10 != 0:
        tmp += 10 - (current % 10)

    ans = 2000
    for i in range(5):
        key = 1 << i
        if (flag & key) != 0:
            continue
        ret = get_ans(flag + key, tmp + dish[i])
        ans = min(ans, ret)
    return ans


print(get_ans(0, 0))

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

minVal = 0
total = 0
for x in abcde:
    mod = x % 10
    if minVal == 0 and mod != 0:
        minVal = mod

    if minVal != 0 and mod != 0 and mod < minVal:
        minVal = mod

    if mod == 0:
        total += x - mod
    else:
        total += x + 10 - mod
if minVal != 0:
    total += minVal - 10
print(total)

Solution (Python):
def additional_time(t: int):
    return (10 - (t % 10)) % 10


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

base_time = sum((A, B, C, D, E))
additional_times = list(map(additional_time, (A, B, C, D, E)))

print(base_time + sum(additional_times) - max(additional_times))

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


dishes = [A, B, C, D, E]
tens = 0
ones = 10
muda = 10
for d in dishes:
    if d % 10 == 0:
        tens += d // 10
    else:
        tens += d // 10 + 1
        if d % 10 < ones:
            muda = d
            ones = d % 10


if muda % 10 == 0:
    ans = tens * 10
else:
    ans = tens * 10 - (10 - muda % 10)
print(ans)

Solution (Python):



from math import ceil

def main():
  s = 0
  xs = []
  for x in [int(input()) for _ in range(5)]:
    if x % 10 == 0:
      s += x
    else:
      xs.append(x)
  if len(xs) < 2:
    print(s + sum(xs))
  else:
    xs = sorted(xs, key=lambda x: x%10, reverse=True)
    print(s + sum(map(lambda x: ceil(x/10)*10, xs[:-1])) + xs[-1])

if __name__=='__main__':
  main()

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

total = 0
min_mod = 10
for t in (a,b,c,d,e):
  total += (t + 9) // 10
  if t%10 != 0:
    min_mod = min(t%10, min_mod)

ans = (total - 1) * 10 + min_mod
print(ans)

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

seq = (a,b,c,d,e)
a = list(itertools.permutations(seq))
mn = 10**4
for i in range(120): 
  sm = 0
  for j in range(4): 
    sm += a[i][j]
    if sm%10 != 0:
      sm += (10-sm%10)
  sm += a[i][-1]
  mn = min(mn, sm)
print(mn)

Solution (Python):
import math
def C(x):
  return math.ceil(x/10)*10
def I():
  return int(input())
def S(x):
  s=str(x)
  if s[-1]!='0':
    return 10-int(s[-1])
  else:
    return 0
a,b,c,d,e=I(),I(),I(),I(),I()
sum=C(a)+C(b)+C(c)+C(d)+C(e)
x=max(S(a),max(S(b),max(S(c),max(S(d),S(e)))))
print(sum-x)

Solution (Python):
time = []
rem = []
for _ in range(5):
    n = int(input())
    time.append(n)
    if n % 10 != 0:
        rem.append(10 - n % 10)

rem.sort()
ans = sum(time) + sum(rem[:len(rem)-1])

print(ans)

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


aa = (a-1) % 10
bb = (b-1) % 10
cc = (c-1) % 10
dd = (d-1) % 10
ee = (e-1) % 10

i = min([aa,bb,cc,dd,ee]) + 1

t = 0
if a % 10 == 0:
  t += a
else:
  t += a + 10 - (a % 10)
if b % 10 == 0:
  t += b
else:
  t += b + 10 - (b % 10)
if c % 10 == 0:
  t += c
else:
  t += c + 10 - (c % 10)
if d % 10 == 0:
  t += d
else:
  t += d + 10 - (d % 10)
if e % 10 == 0:
  t += e
else:
  t += e + 10 - (e % 10)
t -= 10
t += i
print(t)

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

dic = {}

for i in range(5):
    if str(a[i])[-1] == "0":
        dic.update({i: 0})
    else:
        dic.update({i: int(str(a[i])[-1]) - 10})


min_num = [i for i in dic if dic[i] == min(dic.values())][0]
a_sum = sum(a)
dic.pop(min_num)
print(abs(sum(dic.values())) + a_sum)

Solution (Python):
lst = [input() for _ in range(5)]
check = float("inf")
last_num = 0

for i in lst:
    if int(i[-1]) != 0 and int(i[-1]) < check:
        check = int(i[-1])
        last_num = i
if last_num != 0:
    lst.remove(last_num)

for i in range(len(lst)):
    if int(lst[i]) % 10  != 0:
        lst[i] = (int(lst[i]) + (10 - int(lst[i]) % 10))

print(sum(list(map(int,lst))) + int(last_num))

Solution (Python):
import math
ABCDE = [input() for _ in range(5)]
ans = 0
lastorder=float('INF')
_1ketaABCDE = [int(x[-1]) for x in ABCDE]
for i in range(1,10):
    if i in _1ketaABCDE:
        lastorder = _1ketaABCDE.index(i)
        break
for i,x in enumerate(ABCDE):
    if i == lastorder:
        ans += int(x)
    else:
        ans += math.ceil(int(x)/10)*10
print(ans)

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

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

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

    cost.sort(key=lambda v: (v - 1) % 10)

    t = 0
    for c in cost[1:]:
        t += c
        if t % 10 != 0:
            t = (t // 10 + 1) * 10
    t += cost[0]
    print(t)


if __name__ == "__main__":
    main()

Solution (Python):
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


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



def maxtime(x):
    
    return int(-(-x//10)*10)


def remtime(x):
    return int(maxtime(x)-x)


sum = 0
sum = int(maxtime(a)+maxtime(b)+maxtime(c)+maxtime(d)+maxtime(e))
sum -= int(max({remtime(a), remtime(b), remtime(c), remtime(d), remtime(e)}))
print(sum)

Solution (Python):
A = []
B = []
for i in range(5):
  A.append(int(input()))
for i in A:
  B.append((i+9) % 10)
c = B.index(min(B))
for i in range(5):
  if i == c: continue
  else:
    if A[i] % 10 == 0: continue
    else:
      A[i] = (A[i]//10 + 1) * 10

print(sum(A))

Solution (Python):
don, curry,pasta,ramen,hamburger=[int(input()) for i in range(5)]
list=[[don,int(str(don)[-1]) if  10-int(str(don)[-1]) == 10 else 10-int(str(don)[-1]) ,int(str(don)[-1])]
,[curry,int(str(curry)[-1]) if  10-int(str(curry)[-1]) == 10 else 10-int(str(curry)[-1]) ,int(str(curry)[-1])]
,[pasta,int(str(pasta)[-1]) if  10-int(str(pasta)[-1]) == 10 else 10-int(str(pasta)[-1]) ,int(str(pasta)[-1])]
,[ramen,int(str(ramen)[-1]) if  10-int(str(ramen)[-1]) == 10 else 10-int(str(ramen)[-1]) ,int(str(ramen)[-1])]
,[hamburger,int(str(hamburger)[-1]) if  10-int(str(hamburger)[-1]) == 10 else 10-int(str(hamburger)[-1]) ,int(str(hamburger)[-1])]]

time=0
list = sorted(list, key=lambda x: x[1]) 
for food in list:
  time+=food[0] + food[1]

print(time-list[4][1])

Solution (Python):
time = 0
d = 10
for _ in range(5):
    a = int(input())
    r = a%10
    if (0<r and r<d) or d==10 or (0<r and d==0):
        d,t = r,a
    time += a//10
    if r!=0: time+=1
time -= t//10
if d!=0: time-=1
time *= 10
time += t
print(time)

Solution (Python):
import math

price = [int(input()) for i in range(5)]
price.sort(key = lambda i:-i%10)
ans = 0
for i in range(4):
  ans += math.ceil(price[i]/10)*10
  
ans += price[4]

print(ans)

Solution (Python):
import math

menu_time = [int(input()) for i in range(5)]
mini_index = -1
mini_val = float('inf')

for i in range(len(menu_time)):
    tmp = menu_time[i] - (menu_time[i] // 10 * 10)

    if (0 < tmp < mini_val):
        mini_index = i
        mini_val = tmp

time = 0

for i in range(len(menu_time)):

    if (i != mini_index):
        t = math.ceil(menu_time[i] / 10) * 10
        time += t
    else:
        time += menu_time[i]

print(time)

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

Solution (Python):
import math
orders=[int(input()) for i in range(5)]
maximum,total=0,0
for order in orders:
    time=math.ceil(order/10)*10
    total+=time
    remaine=time-order
    maximum=max(maximum,remaine)
print(total-maximum)

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

import itertools

dish_list = list(itertools.permutations(dish))

time = 0
time_list = []

for i in range(len(dish_list)):
    for j in range(5):
        time += dish_list[i][j]
        if time%10 != 0 and j != 4:
            time += 10-(time%10)
            
    time_list.append(time)
    time = 0
    
print(min(time_list))

Solution (Python):
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())
box=[a,b,c,d,e]
li_0=[]
li= []
for i in box:
    if i[-1] == "0":
        li_0.append([i,i[-1]])
    else:
        li.append([i,i[-1]])

li.sort(key = lambda x :x[1], reverse=True)
li_0[len(li_0):len(li_0)] = li


ans = 0
count = 0
for i in li_0:
    if i[-1]=="0":
        ans += int(i[0])
    elif count==len(box)-1:
      ans += int(i[0])
    else:
        ans += int(i[0]) + 10 -int(i[-1])
        
    count+=1
print(ans)

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

Menu = [A,B,C,D,E]
ans = 0
mint = 9
maxt = 0

for i in Menu :
    ans += (i+9)//10
    maxt = max(i%10, maxt)
    if i%10 != 0 :
        mint = min(i%10, mint)

if maxt == 0 :
    ans = ans * 10
else :
    ans = ans * 10 - 10 + mint
print(ans)

Solution (Python):
from itertools import permutations
a2e = [int(input()) for i in range(5)]

perm = list(permutations(list(range(5))))

m = 643
t = 0

for i in perm:
    for j in range(5):
        t += a2e[i[j]]
        if t % 10 != 0 and j < 4:
            wait = 10 - (t % 10)
            t += wait
    if m > t:
        m = t
    t = 0
print(m)

Solution (Python):
M = list(int(input()) for _ in range(5))
Ms = list(map(str, M))
M1 = []
lastM = 0
time = 0
for i in Ms:
    if i[-1] != "0":
        M1.append(i[-1])
    elif i[-1] == "0":
        M1.append("9")
lastM = M1.index(str(min(map(int, M1))))
last = M.pop(lastM)
for i in M:
    if i % 10 == 0:
        time += i
    else:
        time += (i // 10) * 10 + 10
print(time + last)

Solution (Python):

Dish=[int(input()) for _ in range(5)]
Mod=[(D-1)%10+1 for D in Dish]
print(sum([-(-D//10)*10 for D in Dish])-(10-min(Mod)))

Solution (Python):
amari = 10
ab = []
for _ in range(5):
    a=int(input())
    ab.append(a)
    if a%10 == 0:
        continue
    amari = min(amari,a%10)

ans = 0
for i in range(len(ab)):
    if ab[i]%10 == 0:
        ans += ab[i]
    elif ab[i]%10 == 1:
        ans += ab[i]+9
    elif ab[i]%10 == 2:
        ans += ab[i]+8
    elif ab[i]%10 == 3:
        ans += ab[i]+7
    elif ab[i]%10 == 4:
        ans += ab[i]+6
    elif ab[i]%10 == 5:
        ans += ab[i]+5
    elif ab[i]%10 == 6:
        ans += ab[i]+4
    elif ab[i]%10 == 7:
        ans += ab[i]+3
    elif ab[i]%10 == 8:
        ans += ab[i]+2
    elif ab[i]%10 == 9:
        ans += ab[i]+1
print(ans+amari-10)

Solution (Python):
import math

menu = []
for _ in range(5):
    m = input()
    e = int(m[-1])
    if e == 0:
        e = 10
    menu.append([int(m), e])
menu.sort(key=lambda x: x[1])

ans = 0
for m in menu[1:]:
    ans += math.ceil(m[0]/10)*10
print(ans + menu[0][0])

Solution (Python):



N_list = [int(input().strip()) for _ in range(5)]


diff=0
sum=0
for i,v in enumerate(N_list):
    d = (10 - (v % 10)) % 10
    if diff < d:
        diff = d
    
    sum += -(-v // 10)*10

sum -= diff
print(sum)

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

Solution (Python):
l = [int(input()) for _ in range(5)]
m = 100
ind = 100
res = 0
for i in range(5):
    if l[i]%10 == 0:
        continue
    if l[i]%10 < m:
        m = l[i]%10
        ind = i
for i in range(5):
    if i == ind:
        continue
    else:
        res += -(-l[i]//10)*10
if ind < 5:
    res += l[ind]
print(res)

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

Solution (Python):
from itertools import permutations
A_list = []
for i in range(5):
    A = int(input())
    A_list.append(A)
nes = [0,1,2,3,4]
iterator = []
for i in permutations(nes):
    iterator.append(i)
min1 = 10**9
for i in iterator:
    temp = 0
    for j in i:
        if temp%10 != 0:
            temp += (10-temp%10)
        temp += A_list[j]
    if temp < min1:
        min1 = temp
print(min1)

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

Solution (Python):
ans = 0

l = [int(input()) for _ in range(5)]
m = [10 - (p % 10) for p in l if p % 10 != 0]
print(sum(l) + sum(sorted(m)[:-1]))

Solution (Python):

cook_times = []
mod_times = []
for _ in range(5):
    cook_time = int(input())
    mod_ten = cook_time % 10
    if mod_ten == 0:
        mod_ten = 124
    cook_times.append(cook_time)
    mod_times.append(mod_ten)
    
min_mod = mod_times.index(min(mod_times))

for i in range(5):
    if i == min_mod:
        continue
    if cook_times[i] % 10 != 0:
        cook_times[i] = (cook_times[i] // 10) * 10 + 10
    
print(sum(cook_times))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time_list = [a,b,c,d,e]
time_loss_list = [a,b,c,d,e]
loss = []
for i in range(len(time_list)):
    time_loss = 0
    while time_loss_list[i]%10 != 0:
        time_loss += 1
        time_loss_list[i]+=1
    loss.append(time_loss)
loss = sorted(loss)
print(sum(time_list) + sum(loss) - loss[-1])

Solution (Python):

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

for k in list_1:
    num_to_10 = 0
    if k % 10 == 0:
        list_2.append(0)
        continue
    while k % 10 != 0:
        k += 1
        num_to_10 += 1
    list_2.append(num_to_10)

last_dish_ind = list_2.index(max(list_2))
last_dish_time = list_1[last_dish_ind]
del list_1[last_dish_ind]
del list_2[last_dish_ind]
time = sum(list_1) + sum(list_2) + last_dish_time
print(time)

Solution (Python):
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

a = nin(5)
ans = sum(a)
m = 0
for i in range(5):
    k = abs(a[i] % 10 - 10)
    if k != 10:
        ans += k
        m = max(m, k)
ans -= m
print(ans)

Solution (Python):
import math
L = [int(input()) for _ in range(5)]
T = [math.ceil(l/10)*10-l for l in L]
print(sum(L)+sum(T)-max(T))

Solution (Python):
def ceil(src, range):
    return ((int)((src+9) / range) * range)

t=[int(input()) for _ in range(5)]
idx=0
max=0
sum=0
for i in range(5):
    if ceil(t[i],10)-t[i]>max and ceil(t[i],10)!=t[i]:
        max=ceil(t[i],10)-t[i]
        idx=i
for i in range(5):
    if i==idx:
        sum+=t[i]
    else:
        sum+=ceil(t[i],10)
print(sum)

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

A_1 = int(str(10-(A-int(A/10)*10))[-1])
B_1 = int(str(10-(B-int(B/10)*10))[-1])
C_1 = int(str(10-(C-int(C/10)*10))[-1])
D_1 = int(str(10-(D-int(D/10)*10))[-1])
E_1 = int(str(10-(E-int(E/10)*10))[-1])

_max = max(A_1,B_1,C_1,D_1,E_1)


print(A+B+C+D+E+A_1+B_1+C_1+D_1+E_1-_max)

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