a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = (a,b,c,d,e)
min_val = min(lst, key=lambda x: 10 if x%10==0 else x%10)
total_time = min_val
for val in lst:
    if val != min_val:
        if val % 10 == 0:
            total_time += val
        else:
            total_time += ((val // 10)+1)*10
print(total_time)