a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = a+b+c+d+e
l = []
l.append(10- a%10)
l.append(10-b%10)
l.append(10-c%10)
l.append(10-d%10)
l.append(10-e%10)
l.sort()
print(s+sum(l[:-1]))