import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

about = [math.ceil(a/10)*10,math.ceil(b/10)*10,math.ceil(c/10)*10,math.ceil(d/10)*10,math.ceil(e/10)*10]
one = [a%10,b%10,c%10,d%10,e%10]
one.sort()
count = 0
for i in one:
    if i != 0:
        count = i
        break
print(sum(about)+count-10)