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

v = []
for i in range(5):
    v.append(I())

# 全探索？
# 1の位が一に一番近いものを求める
str_v = [str(i) for i in v]
min_first_digit = None
for sidx, s in enumerate(str_v):
    if s[-1] == '0':
        continue
    if min_first_digit == None:
        min_first_digit = [sidx , s[-1]]
        continue
    if s[-1] < min_first_digit[1]:
        min_first_digit = [sidx, s[-1]]

if min_first_digit == None:
    print(sum(v))
else:
    result = 0
    for vidx, item in enumerate(v):
        if vidx != min_first_digit[0]:
            result += item
            if item % 10 != 0:
                result += 10 - item % 10
    result += v[min_first_digit[0]]
    print(result)


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

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

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

ceil = lambda number: math.ceil(number / 10) * 10

minutes = [A, B, C, D, E]
ceiled_minutes = list(map(ceil, minutes))

maximum_diff = 0
for minute in minutes:
    ceiled = ceil(minute)
    diff = ceiled - minute
    if diff == 0: continue

    if maximum_diff is None or diff > maximum_diff:
        maximum_diff = diff

answer = sum(ceiled_minutes) - maximum_diff
    
print(answer)


# Optimized solution
import math

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

ceil = lambda number: math.ceil(number / 10) * 10

minutes = [A, B, C, D, E]
ceiled_minutes = list(map(ceil, minutes))

minimum = 10
for minute in minutes:
    digit_1st = minute % 10
    if digit_1st == 0: continue

    if minimum is None or digit_1st < minimum:
        minimum = digit_1st
diff = 10 - minimum

answer = sum(ceiled_minutes) - diff

print(answer)
# Original solution
a = [ int(eval(input())) for _ in range(5)]
n = float("inf")
for i in range(5):
    if 0 < a[i] % 2 < 10:
        n = min(n,a[i] % 10)
else:
    if n == float("inf"):
        n = 10
print((sum([(-a[i]//10)*-10 for i in range(5)]) -(10-n)))

# Optimized solution
a = [int(eval(input())) for _ in range(5)]
b = 10-min([a[i]%10 for i in range(5) if 0 < a[i]%10] or [10])
print((sum([(-(-a[i]//10)) for i in range(5)])*10-b))
# Original solution
A = sorted( [input()[::-1] for i in range(5)] )
while (A[0][0] == "0"):
  tmp = A.pop(0)
  A.append(tmp)

A = [int(a[::-1]) for a in A][::-1]

def roundUp(n):
  return n if n%10==0 else n + (10-n%10)

print((sum([roundUp(A[i]) for i in range(4)]) + A[4]))


# Optimized solution
A = sorted( [input()[::-1] for i in range(5)] )
c = 0
while (A[0][0] == "0" and c<5):
  tmp = A.pop(0)
  A.append(tmp)
  c+=1

A = [int(a[::-1]) for a in A][::-1]

def roundUp(n):
  return n if n%10==0 else n + (10-n%10)

print((sum([roundUp(A[i]) for i in range(4)]) + A[4]))
# Original solution

from itertools import permutations

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

minT = 10000

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


# Optimized solution

a = [int(eval(input())) for _ in range(5)]
b = []
for i in range(len(a)):
    if a[i] % 10 == 0:
        b.append(0)
    else:
        b.append(10 - (a[i] % 10))
c = b.index(max(b))

ans = 0
for i in range(5):
    if i !=c:
        if a[i] % 10 == 0:
            ans += a[i]
        else:
            ans += ((a[i] // 10) + 1) * 10
print((ans+a[c]))
# Original solution
A=list(int(eval(input()))for i in range(5))
ans=0
num=0
com=0
for a in A:
    if a%10==0:
        ans+=a
    else:
        tmp=10-a%10
        ans+=(a//10+1)*10
        if com<tmp:
            com=tmp
            num=a
if num==0:
    print(ans)
else:
    ans-=(num//10+1)*10
    ans+=num
    print(ans)


# Optimized solution
A=list(int(eval(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)))
# Original solution
from itertools import permutations
foods = [int(eval(input())) for i in range(5)]
ans = 1230
for i in permutations(foods):
    tmp = 0
    for j in range(4):
        tmp += -(-i[j] // 10)
    tmp *= 10
    tmp += i[4]
    ans = min(ans, tmp)
print(ans)

# Optimized solution
foods = [int(eval(input())) for i in range(5)]
amari = [i % 10 for i in foods]
kiriage = [-(-i//10) for i in foods]
min_amari = 10
for i in amari:
    if 1 <= i < min_amari:
        min_amari = i
print((sum(kiriage) * 10 - (10 - (10 if max(amari) == 0 else min_amari))))
# Original solution
#!/usr/bin/env python3

import re
a = []
b = []
for i in range(5):
    x = int(eval(input()))
    a.append(x)
    x = x%10
    b.append(x)

count = 0
min = 123
k = 0
for i in range(5):
    if(b[i] != 0 and min > b[i]):
        min = b[i]
        k = i

for i in range(5):
    if(i != k and b[i] != 0):
        count += a[i] + 10 - b[i]
    elif(i == k or b[i] == 0):
        count += a[i]
print(count)


# Optimized solution
#!/usr/bin/env python3
#ABC123 B

LI = [int(eval(input())) for _ in range(5)]
LI2 = [LI[i] % 10 for i in range(5)]

x = [(LI[i],LI2[i]) for i in range(5)]
#print(x)

ans = 0
x = sorted(x, key = lambda x:x[1],reverse = True)
for i in range(5):
    if x[i][1] == 0:
        t = x[i]
        x.remove(t)
        x.insert(0,t)
#print(x)

for i in range(4):
    if x[i][1] != 0:
        ans += x[i][0] + (10 - x[i][1])
    else:
        ans += x[i][0]
ans += x[4][0]
print(ans)
# Original solution
a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
d=int(eval(input()))
e=int(eval(input()))

l=[a,b,c,d,e]
ansl=[]
import itertools
for v in itertools.permutations(l,5):
  orderl=list(v)
  #print(orderl)
  t=0
  for order_time in orderl:
    if t%10!=0:
      t=((t//10)+1)*10
    t+=order_time
  ansl.append(t)
print((min(ansl)))

# Optimized solution
tl=[int(eval(input())) for i in range(5)]

import itertools

ansl=[]

for tup in itertools.permutations(tl):
    t=list(tup)
    c=0
    for i in range(4):
        c+=t[i]
        if c%10!=0:
            c=(c//10 +1)*10
    ansl.append(c+t[-1])

print((min(ansl)))
# Original solution
a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
d=int(eval(input()))
e=int(eval(input()))
def time(x):
    return (x+9)//10*10
def last(x):
    return time(x)-x
sum_time=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_time-max(last(a),last(b),last(c),last(d),last(e))
print(ans)

# Optimized solution
a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
d=int(eval(input()))
e=int(eval(input()))
def time(x):
    return (x+9)//10*10
def last(x):
    return time(x)-x
sum_tim=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_tim-max(last(a),last(b),last(c),last(d),last(e))
print(ans)
# Original solution
def round_up(i):
    if i % 10 == 0:
        return i
    return 10 - i % 10 + i


minutes = [int(eval(input())) for i in range(5)]
m = [round_up(i) for i in minutes]
last = min((minutes[l] - 1) % 10 for l in range(5)) + 1

print((sum(m) + last - 10))


# Optimized solution
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

arr = [i_i() for _ in range(5)]
arr.sort(key=lambda a: a%10)

flag = True
ans = 0
for x in arr:
    if flag and x % 10 >= 1:
        ans += x
        flag = False
    else:
        if x % 10 != 0:
            ans += (x + 10) // 10 * 10
        else:
            ans += x // 10 * 10

print(ans)
# Original solution
from math import ceil 
L=[]
X=0
M=int(eval(input()))
L.append(M)
for i in range(4) :
  A=int(eval(input()))
  L.append(A)
  if A%10 < M%10 and A%10!=0 :
    M=A
L.remove(M)
for i in L :
  X+=ceil(i/10)*10
print((X+M))

# Optimized solution
L=[]
M=[0]
for i in range(5) :
  A=int(eval(input()))
  L.append(A)
  if A%10!=0 :
    M.append(10-A%10)
print((sum(L+M)-max(M)))
# Original solution
from math import ceil
ord = [int(eval(input())) for _ in range(5)]
max_wait = 0
max_idx = 0
for i in range(5):
    cur = ceil(ord[i] / 10) * 10 - ord[i]
    if max_wait < cur:
        max_wait = cur
        max_idx = i
ans = 0
for i in range(5):
    if i != max_idx:
        ans += ceil(ord[i] / 10) * 10
ans += ord[max_idx]
print(ans)

# Optimized solution
ant = [int(eval(input())) for _ in range(5)]

minidx = 0
minval = 124
i = 0
for a in ant:
    while 10 < a:
        a %= 10
        if a == 0:
            a = 10
    if a < minval:
        minidx = i
        minval = a
    i += 1

ans = 0
for i in range(5):
    if i == minidx:
        continue
    fact = 10
    while fact - ant[i] < 0:
        fact += 10
    ans += fact

ans += ant[minidx]
print(ans)
# Original solution
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

aa = [int(eval(input())) for _ in range(5)]
ans = 0
tmp = INF
for a in aa:
    ans += (a-1)//10 * 10 + 10
    tmp = min(tmp,(a-1)%10+1)

print((ans+tmp-10))


# Optimized solution
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

order = [int(eval(input())) for _ in range(5)]
ans = 0
last = INF
for i in range(5):
    ans += ((order[i]-1)//10+1) * 10
    last = min(last,(order[i]-1)%10+1)

print((ans-10+last))
# Original solution
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


DISH = list(map(int, read().split()))

temp = 10
im = 0
for num, i in enumerate(DISH):
    if i % 10 < temp and i % 10 != 0:
        temp = i % 10
        im = num

ans = 0
for num, i in enumerate(DISH):
    if num != im:
        ans += ((i + 9) // 10) * 10
    else:
        ans += i
print(ans)


# Optimized solution
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

DISH = [int(readline()) for _ in range(5)]
Ceiled = [(i + 9) // 10 * 10 for i in DISH]
div = [y - x for x, y in zip(DISH, Ceiled)]

print((sum(Ceiled)-max(div)))
# Original solution
import math
import sys

ts = [int(i) for i in sys.stdin.read().split('\n') if i != '']
ds = [int(math.ceil(t / 10) * 10) - t for t in ts]
m = max(ds)
ds.remove(m)
ans = sum(ts) + sum(ds)
print(ans)


# Optimized solution
import math
import sys

ts = [int(i) for i in sys.stdin.read().strip().split('\n')]
ds = [int(math.ceil(t / 10) * 10) - t for t in ts]
ans = sum(ts) + sum(ds) - max(ds)
print(ans)
# Original solution
a = [[int(eval(input())), 0]for i in range(5)]
for i in range(5):
    if a[i][0] % 10 == 0:
        a[i][1] = 9
    else:
        a[i][1] = a[i][0] % 10
a = sorted(a, key=lambda x: x[1], reverse=True)
b = 0
for i in range(5):
    if i == 4:
        b += a[i][0]
    else:
        b += (a[i][0] + 9) // 10 * 10
print(b)


# Optimized solution
a = []
for i in range(5):
    b = int(eval(input()))
    a.append([(b+9) % 10, b])
a = sorted(a, reverse=True)
c = 0
for i in range(4):
    c += (a[i][1] + 9) // 10 * 10
print((c + a[4][1]))
# Original solution
import itertools
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
D = int(eval(input()))
E = int(eval(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)
    

# Optimized solution
import itertools
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
D = int(eval(input()))
E = int(eval(input()))
ls = [A,B,C,D,E]
ls2 = []
for i in itertools.permutations(ls,5):
  ls2.append(list(i))
minimum = 10**5
for i in ls2:
  now = 0
  for j in range(5):
    if j == 0:
      now += i[j]
    else:
      if now % 10 == 0:
        now += i[j]
      else:
        now = 10 * (now//10+1)
        now += i[j]
  if now < minimum:
    minimum = now
print(minimum)
# Original solution
A = 0
B = []
B.append(0)
for i in range(5):
  I = int(eval(input()))
  A += I
  T = I % 10
  if T != 0:
    B.append(10 - T)
print((A + sum(B) - max(B)))


# Optimized solution
import math
A = [int(eval(input())) for _ in range(5)]
B = 10
ans = 0
for i in range(5):
  if A[i] % 10 < B and A[i]%10 > 0:
    B = A[i] % 10
    ans = -10+B
for j in A:
  ans += math.ceil(j/10)*10
print(ans)
# Original solution
import itertools
import math
import fractions
import functools
import copy

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
original = [a,b,c,d,e]

sum = 0
minimum = 10
index = 0
for i in range(len(original)):
    if original[i] % 10 != 0:
        sum += original[i]//10 * 10 + 10
        if original[i]%10 < minimum:
            index = i
            minimum = original[i]%10
    else:
        sum += original[i]
if minimum != 10:
    print((sum-(original[index]//10 * 10 + 10)+original[index]))
else: print((a+b+c+d+e))

# Optimized solution
def main():
    # s = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    # s = input()

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

    total = 0
    li = [a, b, c, d, e]
    mini = 10**10
    ans_idx = 0
    for i, s in enumerate(li):
        last_s = int(str(s)[-1])
        if mini > last_s and last_s != 0:
            mini = last_s
            ans_idx = i

    for i, s in enumerate(li):
        if i != ans_idx:
            if s % 10 != 0:
                total += s // 10 * 10 + 10
            else:
                total += s
        else:
            total += s

    print(total)


if __name__ == '__main__':
    main()
# Original solution
import math 

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

tmp = 11
log = -1
for idx,a in enumerate(al):
    point = a % 10
    if point == 0:
        point = 10
    if tmp > point:
        tmp = point
        log = idx

ans = 0
for idx, a in enumerate(al):
    if idx != log:
        ans += math.ceil(a / 10) * 10
    else:
        ans += a
    
print(ans)

# Optimized solution
ans = 0
def ceil(a, b):
   return a // b + (a % b > 0)
big = 0
for _ in range(5):
    a = int(eval(input()))
    ans += ceil(a, 10) * 10
    if a % 10 != 0:
        big = max(big, 10-(a%10))

print((ans-big))
# Original solution
import math

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

ans = 0
r = 0
for z in Z:
    if z%10 != 0:
        r = max(10 - z%10, r)
    ans += math.ceil(z/10) * 10

print((ans - r))

# Optimized solution
Z = [int(eval(input())) for _ in range(5)]

ans = 0
r = 0
for z in Z:
    time = (z+9) // 10 * 10
    r = max(r, time - z)
    ans += time

print((ans - r))
# Original solution
import itertools
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))

ans = 10**18
for v in itertools.permutations([a, b, c, d, e], 5):
    m = 0
    for i in range(len(v)):
        m += v[i]
        if i == len(v)-1:
            break
        if v[i] % 10 != 0:
            m += 10 - v[i] % 10
    ans = min(ans, m)
print(ans)


# Optimized solution
import itertools
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))

l = sorted([a, b, c, d, e], key=lambda x: x % 10)

ans = 0
flag = False
for i in range(len(l)):
    if l[i] % 10 == 0:
        ans += l[i]
    elif flag == False:
        ans += l[i]
        flag = True
    else:
        ans += l[i]
        ans += 10 - l[i] % 10
print(ans)

'''
ans = 10**18
for v in itertools.permutations([a, b, c, d, e], 5):
    m = 0
    for i in range(len(v)):
        m += v[i]
        if i == len(v)-1:
            break
        if v[i] % 10 != 0:
            m += 10 - v[i] % 10
    ans = min(ans, m)
print(ans)

'''
# 全ての順列を計算する、最後の値は１０の余りを加算しない。
# Original solution
a = []
for i in range(5):
    b = int(eval(input()))
    c = b % 10 if b % 10 != 0 else 9
    d = (b + 10 - 1) // 10 * 10
    a.append([b, c, d])
a = sorted(a, key=lambda x: x[1], reverse=True)
total = 0
for i in range(len(a)):
    total += a[i][2]
print((total - a[i][2] + a[i][0]))


# Optimized solution
import itertools
a = [int(eval(input())) for _ in range(5)]
mi = 10 ** 10
for i in itertools.permutations(a, 5):
    t = 0
    for j, v in enumerate(i):
        if j == 4:
            t += v
        else:
            t += ((v + 9) // 10 * 10)
    mi = min(t, mi)
print(mi)
# Original solution
import math

# 定義
minutes = [int(eval(input())) for i in range(5)]
m = [math.ceil(minutes[k] / 10) * 10 for k in range(5)]

# 最後に注文するやつを決める
last = min((minutes[l] - 1) % 10 for l in range(5))
last += 1

#　出力
print((m[0] + m[1] + m[2] + m[3] + m[4] + last - 10))


# Optimized solution
from math import ceil

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

mmin = 10
ans = 0
for ai in A:
    ans += 10*ceil(ai/10)
    if ai%10 != 0:
        mmin = min(mmin, ai%10)
if mmin%10 == 0:
    print(ans)
else:
    print((ans - 10 + mmin))
# Original solution
import math
 
S = []
L = []
for i in range(5):
    D = int(eval(input()))
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)
 
print((int((sum(S) - max(L))*10)))

# Optimized solution
import math
s = []
l = []

for i in range(5):
    d = int(eval(input()))
    t = math.ceil(d / 10)
    s.append(t)
    l.append(t-d/10)
    
print((int((sum(s) - max(l))*10)))
# Original solution
ans = 0
b = 0
for i in range(5):
    a = int(eval(input()))
    ans += -(-a//10)*10
    b = max(b, (10-a%10)%10)
ans -= b
print(ans)

# Optimized solution
ans = 0
b = 0
for i in range(5):
    a = int(eval(input()))
    ans += -(-a//10)*10
    b = max(b, -a%10)
ans -= b
print(ans)
# Original solution
from itertools import permutations
from math import ceil

times = list(int(eval(input())) for _ in range(5))
orders = list(permutations(times, 5))
minimum = sum(ceil(time/10)*10 for time in times)

for order in orders:
    cnt = order[0]
    for i in range(1, 5):
        cnt += ceil(order[i]/10)*10
    minimum = min(minimum, cnt)
print(minimum)


# Optimized solution
from itertools import permutations
from math import ceil

times = list(int(eval(input())) for _ in range(5))
orders = list(permutations(times, 5))
minimum = sum(ceil(time/10)*10 for time in times)

for order in orders:
    total = order[0]
    for i in range(1, 5):
        total += ceil(order[i]/10)*10
    minimum = min(minimum, total)
print(minimum)
# Original solution
a = [int(eval(input())) for i in range(5)]
if all(n%10==0 for n in a):
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b)
else:
    A = min([j%10 for j in a if j%10 != 0])
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print((b-(10-A)))

# Optimized solution
l = [int(eval(input())) for _ in range(5)]
l.sort(key=lambda x: 10 if x%10==0 else x%10)
l = l[::-1]
ans = 0
for i in range(5):
    if i == 4 or l[i]%10==0:
        ans += l[i]
    else:
        ans += ((l[i]//10)+1)*10
print(ans)
# Original solution
import itertools
import math

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

tlist = [A, B, C, D, E]
l = itertools.permutations(tlist, 5)

t = []
count = 0

for i in l:
  count = 0
  for j in range(5):
    if j != 4 :
      count += int(math.ceil(i[j] / 10) * 10)
    else:
      count += i[j]
  t.append(count)
  
print((min(t)))

# Optimized solution
import math

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

tlist = [A, B, C, D, E]
mod_list = [A % 10, B % 10, C % 10, D % 10, E % 10]
mod_list_2 = mod_list[:]
count = 0
already = 0

while 0 in mod_list_2:
  mod_list_2.pop(mod_list_2.index(0))
  
min_mod = 0
if mod_list_2:
  min_mod = min(mod_list_2)
  
if min_mod == 0:
  print((A + B + C + D + E))
else:
  for i in tlist:
    if (i % 10 == min_mod) and already == 0:
      already = i
    else:
      count += int(math.ceil(i / 10) * 10)
  else:
    count += already
    print(count)
# Original solution
from itertools import permutations


cook_times = [int(eval(input())) for _ in range(5)]
ans = float('inf')
for ts in permutations(cook_times):
    total = 0
    for t in ts[:-1]:
        if t % 10 == 0:
            total += t
        else:
            total += (t + 9) // 10 * 10
    ans = min(ans, total + ts[-1])
print(ans)

# Optimized solution
cook_times = sorted([int(eval(input())) for _ in range(5)], key=lambda x: (x + 9) // 10 * 10 - x)
ans = 0
for t in cook_times[:-1]:
    ans += (t + 9) // 10 * 10
print((ans + cook_times[-1]))
# Original solution
def stupid():
    from itertools import permutations

    ret = float('inf')
    for p in permutations(a):
        time = 0
        for dish in p:
            time += (10 - (time % 10)) % 10
            time += dish
        ret = min(ret, time)
    return ret

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

# Optimized solution
def stupid(a):
    from itertools import permutations
    ret = float('inf')
    for p in permutations(a):
        time = 0
        for dish in p:
            time += (10 - (time % 10)) % 10
            time += dish
        ret = min(ret, time)
    return ret

def fast(a):
    temp = a[::]
    temp.sort(key=lambda x: (10 - (x % 10)) % 10)
    ret = 0
    for dish in temp:
        ret += (10 - (ret % 10)) % 10
        ret += dish
    return ret

def stress(n):
    from random import randint
    for _ in range(n):
        a = [randint(1, 123) for _ in range(5)]
        expected = stupid(a)
        got = fast(a)
        if got != expected:
            raise Exception('%s -> expected:%d, got:%d' % (' '.join(map(str, a)), expected, got))

test = False
if test:
    stress(1000)
else:
    a = [int(eval(input())) for _ in range(5)]
    print((fast(a)))