from functools import reduce
def dishes(a,b,c,d,e):
    s = [a,b,c,d,e]
    k = list(map(lambda x:(int(x/10)+1)*10 if x%10 != 0 else (int(x/10))*10,s))
    x = [k[i] - s[i] for i in range(len(s))]
    i = x.index(max(x))
    s.remove(s[i])
    s.append(k[i])
    ans = reduce(lambda x,y:x + y,s)
    return ans-1

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(dishes(a,b,c,d,e))