a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def f(x):
  return -(-x // 10) * 10
def g(x):
  return x % 10
ans = sum(f(i) for i in [a,b,c,d,e])
ans += min(g(i) for i in [a,b,c,d,e])