import math

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

def orderSort(arr):
    more = 0
    for i in range(4):
        if(arr[i]%10 > arr[i+1]%10):
            arr[i], arr[i+1] = arr[i+1], arr[i]
            more = 1
    return more

while(orderSort(arr)):
    pass

time = 0
for i in range(1, 5):
    time += math.ceil(arr[i]/10) * 10

time += arr[0]

print(time)
