a=[ int(input()) for i in range(5)]
b=[(a[i]-1)%10 for i in range(5)]
m=10-((min(b)+1)%10)
def f(x):
  if x%10==0:
    return x
  else:
    return x-(x%10)+10
ans=-m
for i in range(5):
  ans+=f(a[i])
print(ans)