import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

ceil = lambda number: math.ceil(number / 10) * 10
ceiled_A = ceil(A)
ceiled_B = ceil(B)
ceiled_C = ceil(C)
ceiled_D = ceil(D)
ceiled_E = ceil(E)

maximum_diff = None
for minitues in [A, B, C, D, E]:
    ceiled = ceil(minitues)
    diff = ceiled - minitues
    if diff == 0: continue

    if maximum_diff is None or diff > maximum_diff:
        maximum_diff = diff

answer = ceiled_A + ceiled_B + ceiled_C + ceiled_D + ceiled_E - maximum_diff
    
print(answer)
