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

aMod = [0, 0, 0, 0, 0]
for i in range(0,5):
    aMod[i] = a[i] % 10
    if aMod[i] == 0:
        aMod[i] = 10
    a[i] = a[i] + (10 - aMod[i])

aModMin = min(aMod)
if aModMin == 10:
    aModMin = 0

print(sum(a) + aModMin - 10)