A = [int(input()) for i in range(5)]

def make_ten(i):
    ans = 0
    while i % 10 != 0:
        i += 1
        ans += 1
    return [i,ans]

anslist = []
diflist = []
for i in range(5):
    anslist.append(make_ten(A[i])[0])
    diflist.append(make_ten(A[i])[1])

print(sum(anslist)-max(diflist) if max(diflist) != 0 else sum(anslist)-10)