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

sample_list = list(a,b,c,d,e)
z= sum(sample_list)
for f in sample_list:
    g = list(10 - (a % 10))

h = max(g)
i = sum(g) - h

print(z-i)