import math
ans=0
A=[int(input()) for i in range(5)]
a=0
for i in range(5):
  if (A[i]%10)>a:
    p=i
    a=A[i]
for i in range(5):
  if i==p:
    ans+=A[i]
  else:
    ans+=10*(math.ceil(A[i]/10))
print(ans)