import itertools
import math

list = [int(input()) for _ in range(5)]
time = 2*sum(list)

for i in itertools.permutations(list):
    a, b, c, d, e = i
    a = math.ceil(a/10)
    b = math.ceil(b/10)
    c = math.ceil(c/10)
    d = math.ceil(d/10)
    if time > (a + b + c + d)*10 + e:
        time = (a + b + c + d)*10 + e
print(time)
