ae = [int(input()) for _ in range(5)]

sum_ae = 0
g = 9
for i in ae:
    if i % 10 != 0:
        g = min(g, i % 10)
        sum_ae += (i//10 + 1) * 10
    else:
        sum_ae += i

print(sum_ae - (10-g))