a = int(input(''))
b = int(input(''))
c = int(input(''))
d = int(input(''))
e = int(input(''))
list_i = [a,b,c,d,e]

list_m = map(lambda x : 10 - x % 10 ,list_i)
list_i = [x + y if x !=10 else y for (x,y) in zip(list_m,list_i)]
list_v = filter(lambda x : x != 10 , list_m)
print sum(list_i) - max(list(list_v))