arr = []
arr.append(input())
arr.append(input())
arr.append(input())
arr.append(input())
arr.append(input())

min = 0

count = 0

num = 0
num_val = 9
for i in range(5):
    if int(arr[i]) >= 100:
        if int(arr[i]) % 100 < num_val and int(arr[i]) % 100 != 0:
            num = i
            num_val = int(arr[i]) % 100

    else:
        if int(arr[i]) % 10 < num_val and int(arr[i]) % 10 != 0:
            num = i
            num_val = int(arr[i]) % 10


list = []

for i in range(5):
    if i != num:
        list.append(arr[i])
list.append(arr[num])


for i in range(5):
    count += int(list[i])
    if i == 4:
        pass
    else:
        if int(list[i]) % 10 == 0:
            pass
        else:
            count += 10 - (int(list[i])%10)

print(count)
