import math
a = list(range(5))
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
b = list(range(5))
c = list(range(5))
d = 0
s = 9
e = 0
total = 0
for i in range(5):
    if((a[i]%10)==0):
        b[d] = a[i]
        d += 1
    else:
        if((a[i]%10)<s):
            s = a[i]%10
for i in range(5):
    if((a[i]%10)!=0):
        e = a[i]/10
        e = math.ceil(e)
        e = e*10
        b[d] = e
        d += 1
for i in range(5):
    total += b[i]
total -= 10
total += s
print(total)