AE = []
for i in range(5):
    AE.append(int(input()))

ans = 0
mini = []
for i in AE:
    if(i%10 == 0):
        ans += i
    else:
        ans += (i//10 + 1)*10
        mini.append(i%10)
print(ans + min(mini) - 10)