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

l = [a % 10, b % 10, c % 10, d % 10, e % 10]
print((a // 10) * 10 + (b // 10) * 10 + (c // 10) * 10 + (d // 10) * 10 + (d // 10) * 10 + max(l) - 10)
