A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
All = [A, B, C, D, E]
late = 10
late_menu = 0
total = 0
for menu in All:
    if menu % 10 == 0:
        total += menu
        All.remove(menu)
#print(total)
for menu1 in All:
    if menu1 % 10 < late:
        late = menu1 % 10
        late_menu = menu1
All.remove(late_menu)
for x in All:
    if x < 10:
        x = 10
        total += x
    else:
        x = (x // 10 +1) * 10
        total += x
total = total + late_menu
print(total)