min_num = 10
num = 0
count = 0
for i in range(5):
    a = int(input())
    if a % 10 == 0:
       num += a
    else:
        num += ((a//10) + 1) * 10
        min_num = min(min_num, a%10)
        count = 1

print(num+min_num-(count*10))
