import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [a%10,b%10,c%10,d%10,e%10]
g = max(s)
for i in range(len(s)):
    if s[i]:
        g = min(g,s[i])
k = [a,b,c,d,e]
for i in range(len(k)):
    k[i] = math.ceil(k[i]/10)*10
print(sum(k)+g-10)