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

t = [a,b,c,d,e]

min_i = 9
total = 0
for v in t:
  if v%10 < min_i and v%10 > 0:
    min_i = v%10
  if v%10 != 0:
    total += v + 10 - v%10
  else:
    total += v

print(total - 10 + min_i)