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):
R=[int(input()) for i in range(5)]
r=[]
p=10
for i in range(5):
    if R[i] % 10 != 0:
        p = min(p,R[i]%10)
ans = 0
for i in range(5):
    if R[i] % 10 != 0:
        if R[i] % 10 == p:
          ans += R[i]
          p = 10
        else:
          ans += R[i] - R[i] % 10 + 10
    else:
        ans += R[i]
print(ans)

Solution (Python):
import math


def roundup(x):
    return int(math.ceil(x / 10.0)) * 10


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

m = sum(ll)
print(min([m - ll[i] + l[i] for i in range(5)]))

Solution (Python):
from itertools import permutations

a, b, c, d, e = [int(input()) for _ in range(5)]

result = 10 ** 9

p = permutations([a, b, c, d, e])
for case in p:
  t = 0
  for i, dish in enumerate(case):
    if i != 4 and dish % 10 != 0:
      dish += 10 - dish % 10
    t += dish
  
  result = min(result, t)
  
print(result)

Solution (Python):
L = [int(input()) for _ in range(5)]
M = [(10-i%10)%10 for i in L]

print(sum(L)+sum(M)-max(M))

Solution (Python):
time = 0
dif = [0] * 5
for i in range(5):
    y = int(input())
    x = (y + 9) // 10 * 10
    dif[i] = x-y
    time += x 
dif.sort(reverse = True)
time -= dif[0]
print(time)

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

loss = [(10-i%10)%10 for i in a]

print(sum(a+loss)-max(loss))

Solution (Python):
from itertools import permutations
from math import ceil
D = []
for _ in range(5):
    D.append(int(input()))
res = float("inf")
for a in permutations(D,5):
    t = 0
    for b in a[:-1]:
        t += ceil(b/10)*10
    t += a[-1]
    res = min(res, t)
print(res)

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

for i in range(5):
  if int(s[i]) % 10 == 0:
    x10 = x10 + 1
  else:
    a.append(int(s[i]) % 10)
  sum = sum + ((int(s[i]) - 1) // 10 + 1) * 10

  
b = [int(s) for s in a]

if x10 == 5:
  print(sum)
else:
  print(sum - 10 + min(b))

Solution (Python):
def chk(n):
    for i in range(14):
        if i*10 >= n:
            return i*10
    

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

min_i = [10,10]
for i in range(5):
    if time[i]!=0:
        if time[i]<min_i[0]:
            min_i[0] = time[i]
            min_i[1] = i

ans = 0
for i in range(5):
    if i == min_i[1]:
        ans += menu[i]
    else:
        ans += chk(menu[i])
print(ans)

Solution (Python):
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m <= num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))

Solution (Python):
import itertools
a=[]
for i in range(5):
    a.append(int(input()))
out=sum(a)+50
ls = list(itertools.permutations(range(5)))
for i in ls:
    t=0
    for j in i:
        if t%10 != 0:
            t+=10-t%10
        t+=a[j]
    if t <=out:
        out=t
print(out)

Solution (Python):
N = [int(input()) for i in range(5)]
Ni = [0]*5
smallmin = 11
for i in range(5):
    Ni[i] = N[i]%10
    if Ni[i] == 0:
        Ni[i] = 10
    if Ni[i]<smallmin:
        smallmin = Ni[i]
        LAST = i
ans = 0
for i in range(5):
  if i == LAST:
    ans += N[i]
  else:
    ans = ans + N[i] + (10-Ni[i])
print(ans)

Solution (Python):
u = []
time = 0
for i in range(5):
    s = int(input())
    t = ((s+ 9) // 10) * 10
    u.append(t - s)
    time += t
    
print(time - max(u))

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
nn = [a, b, c, d, e]
s = False
for i in nn:
    if s == False and i%10 != 0:
        chk = i%10
        last = i
        s = True
    elif s == False and i%10 == 0:
        pass
    elif s == True and i%10 != 0:
        if chk > i%10:
            chk = i%10
            last = i
if s == False:
    last = a

s = False
for i in nn:
    if s == False and i == last:
        ans += i
        s = True
    else:
        if i%10 == 0:
            ans += i
        else:
            ans += i + (10 - i%10)
    
print(ans)

Solution (Python):
T=[]
for i in range(5):
    T.append(int(input()))
t=[]
for i in range(5):
    t.append(T[i]%10)
a=0
if 0 not in t:
    for i in range(5):
        if t[i]==min(t):
            a=T[i]
            T.remove(T[i])
            break
    for i in range(4):
        a+=((T[i]//10)+1)*10

if 0 in t:
    U=[s for s in T if s%10==0]
    G=[s for s in T if s%10!=0]
    g=[]
    for i in range(len(G)):
        g.append(G[i]%10)
        
    for i in range(len(U)):
        a+=U[i]
        
    for i in range(len(G)):
        if g[i]==min(g):
            a+=G[i]
            G.remove(G[i])
            break
            
    for i in range(len(G)):
        a+=((G[i]//10)+1)*10

print(a)

Solution (Python):
import math


def resolve():
    import sys
    import string
    input = sys.stdin.readline
    
    
    a = int(input().rstrip())
    b = int(input().rstrip())
    c = int(input().rstrip())
    d = int(input().rstrip())
    e = int(input().rstrip())

    max_loss = 0
    ans = 0
    for x in [a,b,c,d,e]:
        if max_loss < (10 - (x % 10)) % 10:
            max_loss = 10 - (x % 10)
        ans += math.ceil(x / 10.0) * 10

    ans -= max_loss
    print(ans)

if __name__ == "__main__":
    resolve()

Solution (Python):
sum=0
minb=10
for i in range(5):
    a=int(input())
    sum += a//10*10 if a%10==0 else a//10*10+10
    b = a%10
    minb = min(minb if b==0 else b, minb)
print(sum-10+minb)

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

ls = [A,B,C,D,E]
ls2 = []
for i in itertools.permutations(ls, 5):
  ls2.append(list(i))
minimum = 10**9+7
for i in range(120):
  ls3 = ls2[i]
  now = 0
  for j in range(5):
    if j == 0:
      now += ls3[j]
    else:
      if now%10 == 0:
        now += ls3[j]
      else:
        now = 10*(now//10+1)
        now += ls3[j]
  if now < minimum:
    minimum = now
print(minimum)

Solution (Python):
sum=0
max=0
for i in range(5):
  A=int(input())
  s=((A+9)//10)*10
  
  p=abs(A-s)%10
  if p>max:
    max=p
    
  sum+=s
print(sum-max)

Solution (Python):
import math
minutes = [int(input()) for _ in range(5)]
minutes = sorted(minutes,key = lambda x:-x%10)
cnt = 0
for i in minutes:
    cnt += math.ceil(i/10)*10

if minutes[-1] % 10 !=0:
    cnt -= 10 - minutes[-1] % 10
print(cnt)

Solution (Python):








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

idx = -1
mi = 10

for i in range(5):
    remain = l[i] % 10
    if remain != 0:
        if mi > remain:
            mi = remain
            idx = i
ans = 0
for i in range(5):
    remain = l[i] % 10
    if (remain == 0):
        ans += l[i]
    else:
        if (i == idx):
            ans += l[i]
        else:
            ans += (l[i] // 10 + 1)*10
print(ans)

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

t = 0

m = 10

for x in a:
    t += (x + 9) // 10 * 10
    m = min((x - 1) % 10 + 1, m)

print(t-10+m)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
alist=[a,b,c,d,e]
num=0
import math
for i in range(5):
  num+=math.ceil(alist[i]/10)*10
num2=10
for i in range(5):
  if alist[i]%10!=0:
    num2=min(num2,alist[i]%10)
print(num-10+num2)

Solution (Python):
x,y=[],[]
t=10
for i in range(5):
    x.append(int(input()))
    y.append(x[i]%10)
    if 0<y[i]<t:
        t=y[i]
    if x[i]%10!=0:
        x[i]=((x[i]//10)+1)*10
    y[i]=x[i]
print(sum(y)+t-10)

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
p = 10
for i in range(5):
    if a[i] % 10 != 0:
        p = min(p,a[i]%10)
ans = 0
for i in range(5):
    if a[i] % 10 != 0:
        if a[i] % 10 == p:
            ans += a[i]
            p = 10
        else:
            ans += a[i] - a[i] % 10 + 10
    else:
        ans += a[i]
print(ans)

Solution (Python):
l = [int(input()) for i in range(5)]
a = min(l, key=lambda x: (x-1)%10)
ret = 0
flag = 0
for i in l:
    if i != a or flag == 1:
        ret += i
    else:
        flag = 1
        
    if ret%10 != 0:
        ret += 10-(ret%10)
ret += a
print(ret)

Solution (Python):

import itertools
ABCDE = [int(input()) for _ in range(5)]
def calc(food):
    time = 0
    for i in food:
        if time % 10 != 0:
            while time % 10 != 0:
                time += 1    
        time += i
    return time
FOOD = list(itertools.permutations(ABCDE))

mini = 650
for j in FOOD:
        ans = calc(list(j))
        if mini > ans:
            mini = ans

print(mini)

Solution (Python):
def multiple_of_ten(number):
    while number % 10 != 0:
        number += 1
    return number


def max_difference_between_two_lst(lst1, lst2):
    difference_lst = []
    for i in range(len(lst1)):
        number1 = lst1[i]
        number2 = lst2[i]
        difference_lst.append(abs(number1 - number2))
    max_difference = max(difference_lst)
    return max_difference


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

    new_time_lst = []
    for i in range(5):
        time = time_lst[i]
        new_time_lst.append(multiple_of_ten(time))

    max_difference = max_difference_between_two_lst(time_lst, new_time_lst)
    fastest = sum(new_time_lst) - max_difference
    print(fastest)


if __name__ == '__main__':
    main()

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

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

if A % 10 == 0:
    a = 0
else:
    a = 10 - A % 10

if B % 10 == 0:
    b = 0
else:
    b = 10 - B % 10

if C % 10 == 0:
    c = 0
else:
    c = 10 - C % 10

if D % 10 == 0:
    d = 0
else:
    d = 10 - D % 10

if E % 10 == 0:
    e = 0
else:
    e = 10 - E % 10

sum = A + B + C + D + E + a + b + c + d + e - max(a,b,c,d,e)

print(sum)

Solution (Python):
a = []
for _ in range(5):
    a.append(int(input()))
res = 0
last_num = a[0]
for i in range(5):
    if a[i] % 10 == 0:
        res += a[i]
    else:
        if last_num % 10 == 0:
            last_num = a[i]
        elif a[i] % 10 < last_num % 10:
            last_num = a[i]
        res += (a[i] // 10 + 1) * 10

if last_num % 10 != 0:
    res -= 10 - last_num % 10
print(res)

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

L = [-i%10 for i in T]

print(sum(T) + sum(L) - max(L))

Solution (Python):
import numpy as np
dishes = [int(input()) for _ in range(5)]
dishes = sorted(dishes, key=lambda x: x % 10)
minutes = 0
first = True
for i in dishes:
    if i % 10 == 0:
        minutes += i
    else:
        if first:
            minutes += i
            first = False
        else:
            minutes += int(np.ceil(i/10)*10)
print(minutes)

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

Solution (Python):
import math
a = [int(input()) for i in range(5)]
w = [ (10 - i % 10) % 10 for i in a]
print(sum(a)+sum(w)-max(w))

Solution (Python):
def order(n):
    if n == 0: return 10
    else: return n


def ceil(num, target):
    if num % target == 0: return num
    return ((int)(num / target) + 1) * target


P = [input() for _ in range(5)]
P_sorted = sorted(P, key=lambda pi: order(int(pi[-1])), reverse=True)

ans = 0
for pi in P_sorted[:-1]:
    ans += ceil(int(pi), 10)

print(ans + int(P_sorted[-1]))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
last = 0
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d // 10)+1) *10
    if last <= d10 - d:
      last = d10 - d
    dish[index] = d10
print(sum(dish)-last)

Solution (Python):
import math

a = [int(input()) for _ in range(5)]
a_2 = [(i-1)%10 for i in a]

last_item=a[a_2.index(min(a_2))]
print(int(sum([math.ceil(i/10)*10 for i in a])+((last_item-1)%10-9)))

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

menuTimeList = [A, B, C, D, E]
menuExtraTimeList = [0, 0, 0, 0, 0]

maxExtraTime = 0
for i in range(5):
    extraTime = 0
    if menuTimeList[i] % 10 == 0:
        menuExtraTimeList[i] = 0 
    else:
        extraTime = 10 - menuTimeList[i] % 10
        menuExtraTimeList[i] = extraTime
    if maxExtraTime < extraTime:
        maxExtraTime = extraTime

answer = sum(menuTimeList) + sum(menuExtraTimeList) - maxExtraTime
print(answer)

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

for c in range(5):
    ABC = input()
    X[c] = [int(ABC), int(ABC[-1])]
    if X[c][1] == 0:
        X[c][1] = 10
        X[c].append(X[c][0])
    else:
        X[c].append(X[c][0] + (10 - X[c][1]))

X.sort(reverse=True, key=lambda val:val[1])

ans = sum([X[x][2] for x in range(4)]) + X[4][0]

print(ans)

Solution (Python):
X = list(map(int, [input() for _ in range(5)]))
X = sorted(X, key=lambda x: x%10)
r = 0
for x in X:
    if x % 10 == 0:
        r += x
    else:
        if r % 10 == 0:
            r += x
        else:
            r += (1+x//10) * 10
print(r)

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

amari = [10]
for i in range(5):
    if time[i]%10 != 0:
        amari += [time[i]%10]
mia = min(amari)


import math
ti = 0
for i in range(5):
    ti += math.ceil(time[i]/10)*10


print(ti-10+mia)

Solution (Python):
cook_list = []
cook_list_2 = []

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

for c in cook_list:
    cook_list_2.append(((c+9)//10)*10)
    
max_diff = 0
for j in range(5):
    if cook_list_2[j] - cook_list[j] >= max_diff:
        max_diff = cook_list_2[j] - cook_list[j]
    
ans = sum(cook_list_2) - max_diff
print(ans)

Solution (Python):



x=[int(input()) for _ in range(5)]
tmp=100
for i in range(5):
    if x[i]%10:
        tmp = min(tmp,x[i]%10)
        x[i]//=10
        x[i]*= 10
        x[i]+=10
ans= sum(x)
if tmp<100:
    ans-=10
    ans+=tmp
print(ans)

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

u = list(map(lambda s: math.ceil(s/10) * 10, t))
z = [b - a for (a, b) in zip(t, u)]
print(sum(u) - max(z))

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

r = []

if A%10 != 0:
    r.append(10 - A%10)
    A += 10 - A%10
if B%10 != 0:
    r.append(10 - B%10)
    B += 10 - B%10
if C%10 != 0:
    r.append(10 - C%10)
    C += 10 - C%10
if D%10 != 0:
    r.append(10 - D%10)
    D += 10 - D%10
if E%10 != 0:
    r.append(10 - E%10)
    E += 10 - E % 10

if r:
    print(A+B+C+D+E-max(r))
else:
    print(A+B+C+D+E)

Solution (Python):
li = []
for i in range(5):
    li.append(int(input()))
mi = 10
for i in range(5):
    a = li[i]%10
    if mi > a and a != 0:
        mi = a
        t = i
if mi != 10:
    a = li[t]
    li.remove(a)
    for i in range(4):
        if li[i] % 10 != 0:
          li[i] += (10 - li[i] % 10)
    print(sum(li) + a)
else:
    print(sum(li))

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

food = []

for _ in range(5):
    food.append(inint())

all = sum(food)
loss = []

for f in food:
    loss_t = 200
    for i in range(0,131, 10):
        if 0 <= i-f < loss_t:
            loss_t = abs(f-i)
    loss.append(loss_t)

print(all+sum(loss)-max(loss))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a%10==0:
    A=a
else:
    A=((a//10)+1)*10
if b%10==0:
    B=b
else:
    B=((b//10)+1)*10
if c%10==0:
    C=c
else:
    C=((c//10)+1)*10
if d%10==0:
    D=d
else:
    D=((d//10)+1)*10
if e%10==0:
    E=e
else:
    E=((e//10)+1)*10
    
time=A+B+C+D+E
muda=[]
muda.append(A-a)
muda.append(B-b)
muda.append(C-c)
muda.append(D-d)
muda.append(E-e)
print(time-max(muda))

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

for i in range(5):
    if y[i] == 0:
        ans += x[i]
    else:
        ans += x[i]-y[i]+10
m = 10
for i in y:
    if i == 0:
        continue
    else:
        m = min(m,i)
if m == 10:
    print(ans)
else:
    print(ans+m-10)

Solution (Python):
import math
abc = [int(input()) for _ in range(5)]
tmp = 9
ans = 0
ii = 0
for i in range(5):
    tmpp = min(tmp, (abc[i]-1)%10)
    if tmp != tmpp:
        tmp = tmpp
        ii = i
for i in range(5):
    if i == ii:
        ans += abc[i]
    else:
        ans += (math.ceil(abc[i]/10))*10
print(ans)

Solution (Python):
L = []
R = []

for _ in range(5):
  x = int(input())
  L.append(x)
  R.append(-x%10)

print(sum(L)+sum(R)-max(R))

Solution (Python):
import math
x=[int(input()) for _ in range(5)]
y=[math.ceil(i/10)*10 for i in x]
ans_m=sum(y)
ans=sum(y)
for i in range(5):
  ans = min(ans, ans_m-y[i]+x[i])
print(ans)

Solution (Python):
import sys
from math import ceil


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = [input() for _ in range(5)]
    mi = 10
    for s in S:
        if not s[-1] == '0':
            mi = min(mi, int(s[-1]))
    S = list(map(lambda x: ceil(int(x) / 10) * 10, S))
    print(sum(S) - (10 - mi))


if __name__ == '__main__':
    main()

Solution (Python):
import math
s = []
l = []

for i in range(5):
    d = int(input())
    t = math.ceil(d / 10)
    s.append(t)
    l.append(t-d/10)
    
print(int((sum(s) - max(l))*10))

Solution (Python):
import math
 
S = []
L = []
for i in range(5):
    D = int(input())
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)
 
print(int((sum(S) - max(L))*10))

Solution (Python):
a =int(input())
b= int(input())
c= int(input())
d= int(input())
e= int(input())
A = abs(a%10-10)
B = abs(b%10-10)
C = abs(c%10-10)
D = abs(d%10-10)
E = abs(e%10-10)
lst= [A,B,C,D,E]
ad = 0
cnt = 0
for i in lst:
    if (i != 10) and (i>ad):
        ad = i
    if i == 10:
        cnt += 1
ans = (a//10+b//10+c//10+d//10+e//10+5-cnt)*10-(ad)
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def g(x):
    if x%10==0:
        return 10
    else:
        return x%10
m=min(g(a),g(b),g(c),g(d),g(e))
def f(x):
    if x%10==0:
        return x
    else:
        return (x//10+1)*10
a=f(a)
b=f(b)
c=f(c)
d=f(d)
e=f(e)
print(a+b+c+d+e+m-10)

Solution (Python):
def solve():
  A = [int(input()) for _ in range(5)]
  m = 0
  ans = 0
  for a in A:
    ans += -(-a//10)*10
    if a%10>0:
      m = max(m,10-a%10)
  ans -= m
  return ans
print(solve())

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

res = 10 ** 5
for i in itertools.permutations(range(5)):
    sum_min = 0
    for j in range(len(i)):
        if j == 4:
            sum_min += a_to_e[i[j]]
        else:
            sum_min += (a_to_e[i[j]] + 9) // 10 * 10
    res = min(res, sum_min)

print(res)

Solution (Python):
import math

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

s = 0
t = 0

for a in abc:
    s += math.ceil(a / 10)
    if a % 10 != 0:
        t = max(t, 10 - a % 10)
        
if t != 0:
    print(s * 10 - t)
else:
    print(s * 10)

Solution (Python):
dishes = []
n = 5
max_rest = 10
for i in range(n):
    dish = int(input())
    if (dish - 1) % 10 < (max_rest - 1) % 10:
        max_rest = dish
    
    dishes.append((dish + 9) // 10 * 10) 
    
res = sum(dishes) - (max_rest + 9) // 10 * 10 + max_rest
print(res)

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

kouho = list(itertools.permutations([a, b, c, d, e]))
ans = 10 ** 6
for k in kouho:
    temp = 0
    for t in range(5):
        amari = k[t] % 10
        if amari != 0 and t != 4:
            temp += 10 - amari
        temp += k[t]
    ans = min(ans, temp)
print(ans)

Solution (Python):
from itertools import permutations
a = [int(input()) for i in range(5)]
p = permutations(a,5)
ans = 10**9
for l in p:
    now = 0
    for i,item in enumerate(l):
        if i == 4:
            now += item
        else:
            now += item + int(bool(item%10))*10 - item%10
    ans = min(ans,now)
print(ans)

Solution (Python):
a=[]
b=[]
ori=[]
ans=0
for i in range(5):
  c=int(input())
  ori.append(c)
  if c%10!=0:
    a.append((c//10+1)*10)
  else:
    a.append(c)
  
  if c%10==0:
    b.append(100)
  else:
    b.append(c%10)
a.pop(b.index(min(b)))
print(ori[b.index(min(b))]+sum(a))

Solution (Python):
import sys
from collections import defaultdict


def input():
    return sys.stdin.readline().rstrip()


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    W = [a, b, c, d, e]

    d = 0
    p = []

    for i in range(5):
        x, y = divmod(W[i], 10)
        if y == 0:
            d += x
            p.append(10)
        else:
            d += x + 1
            p.append(y)

    print(d * 10 + min(p)-10)


if __name__ == "__main__":
    main()

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

ans = 0
for i in [a, b, c, d, e]:
    ans += i//10*10 + (i%10>0)*10

for i in range(1, 10):
    for j in [a, b, c, d, e]:        
        if str(j)[-1] == str(i):
            ans += i - 10
            print(ans)
            exit()
print(ans)

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

L = list(map(int, read().decode("utf-8").split()))

last_ = L[0] % 10
last_index = 0
for i, t in enumerate(L):
    if 0 < t % 10 < last_:
        last_ = t % 10
        last_index = i

ans = 0
for i, t in enumerate(L):
    if i != last_index:
        ans += t
        if t % 10:
            ans += 10 - (t % 10)
ans += L[last_index]
print(ans)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

L = list(map(int, read().decode("utf-8").split()))

import itertools
p = itertools.permutations(L, 5)
ans = INF
for dishes in p:
    tmp_ans = 0
    for i, d in enumerate(dishes):
        tmp_ans += d
        rest = 10 - (d % 10)
        if i != 4 and rest != 10:
            tmp_ans += rest
    ans = min(ans, tmp_ans)
print(ans)

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

last, min = 0, 9
for i in range(n):
    if t[i] % 10 < min:
        if t[i] % 10 == 0:
            continue
        last = i
        min = t[i] % 10

ans = 0
for i in range(n):
    if i == last:
        continue
    if t[i] % 10 == 0:
        diff = 0
    else:
        diff = 10 - t[i] % 10
    ans += t[i] + diff

ans += t[last]

print(ans)

Solution (Python):
from math import ceil

t = [int(input()) for _ in range(5)]
t.sort(key=lambda x: ((x%10)-1)%10+1)
print(t[0] + sum(map(lambda x: ceil(x/10)*10, t[1:])))

Solution (Python):
import math
nums = [int(input()) for _ in range(5)]
mn = float('inf')

for i in nums:
    if i%10!=0:
        mn = min(mn, i%10)
if mn == float('inf'):
    mn = 10

print(sum(list(map(lambda x: int(math.ceil(x/10)*10), nums)))-10+mn)

Solution (Python):
from itertools import permutations
import math
X = [int(input()) for _ in range(5)]
Time = lambda X: sum(math.ceil(X[i]/10)*10 for i in range(4))+X[-1]
print(min(Time(x) for x in permutations(X)))

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

lists = [a,b,c,d,e]
lists_2 = [a%10,b%10,c%10,d%10,e%10]
for i in range(4):
  if 0 in lists_2:
    lists_2.remove(0)
  else:
    pass

count = 0
counter = 0
for i in lists:
  if i%10 == 0:
    count += i
  elif i%10!= min(lists_2):
    count += ((i//10) +1)*10
  else:
    if counter == 0:
      count += i
      counter = 1
    else:
      count += ((i//10) +1)*10
print(count)

Solution (Python):
import math
L = [int(input()) for _ in range(5)]
L.sort(key=lambda x: (x-1)%10)
print(L[0]+sum(map(lambda x:math.ceil(x/10)*10, L[1:])))

Solution (Python):
from itertools import permutations

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

MIN=10**9
for p in permutations(A):
  SUM=0
  for i in range(5):
    if i < 4:
      SUM += (p[i]+10-1)//10*10
    if i == 4:
      SUM += p[i]
  if SUM < MIN:
    MIN = SUM
    
print(MIN)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=[0]*5
a[0]=A
a[1]=B
a[2]=C
a[3]=D
a[4]=E
b=[0]*5
for x in range(5):
  if a[x]%10!=0:
    b[x]=a[x]%10
  else:
    b[x]=10
t=min(b)
ti=b.index(t)
ans=0
for i in range(5):
  if i!=ti:
    if a[i]%10!=0:
      ans+=a[i]+(10-a[i]%10)
    else:
      ans+=a[i]
ans+=a[ti]
print(ans)

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

    l = [A, B, C, D, E]
    c = []
    for i in range(len(l)):
        if i == 0:
            c.append(l[i])
        else:
            if c[0] % 10 > l[i] % 10 and l[i] % 10 != 0:
                c.insert(0, l[i])
            else:
                c.append(l[i])
    ans = 0
    for i in range(len(c)):
        if i == 0:
            ans += c[i]
        else:
            if c[i] % 10 != 0:
                t = c[i] % 10
                ans = ans + c[i] + (10 - t)
            else:
                ans = ans + c[i]
    print(ans)        
main()

Solution (Python):
import math
from itertools import permutations
A = [int(input()) for _ in range(5)]

ans = float("inf")
for a in permutations(A, 5):
    m = 0
    for i in a:
        m = math.ceil(m/10)*10
        m += i
    ans = min(ans, m)
print(ans)

Solution (Python):





























































































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    
    
    
    
    values = list()
    for i in range(5):
        values.append(int(lines[i]))
    
    
    

    su = 0
    amaris = list()

    for value in values:
        amari = value % 10
        if amari > 0:
            amaris.append(10-amari)

    if amaris == []:
        result = sum(values)
    else:
        result = sum(values) + sum(amaris) - max(amaris)

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['29', '20', '7', '35', '120']
        lines_export = [215]
    if pattern == 2:
        lines_input = ['101', '86', '119', '108', '57']
        lines_export = [481]
    if pattern == 3:
        lines_input = ['123', '123', '123', '123', '123']
        lines_export = [643]
    if pattern == -1:
        lines_input = ['10', '10', '10', '10', '10']
        lines_export = [50]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(5)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    if FLAG_LOG:
        log(f'lines_input=[{lines_input}]')
        log(f'lines_export=[{lines_export}]')
        log(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            log('OK')
        else:
            log('NG')
    finished = time.time()
    duration = finished - started
    log(f'duration=[{duration}]')



if __name__ == '__main__':
    main()