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

f = (a/10 + b/10 + c/10 + d/10 + e/10) * 10

g = a % 10

if(b % 10 < g):
  g = b % 10
  
if(c % 10 < g):
  g = c % 10
  
if(d % 10 < g):
  g = d % 10
  
if(e % 10 < g):
  g = e % 10

print(str(f + g))