inputs=[int(input()) for _ in range(5)]
inputs.sort()

ans=0
ans=1000000000000000
for i in range(len(inputs)):
  tmp=0
  for j in range(len(inputs)):
    no=(i+j)%len(inputs)
    if j!=len(inputs)-1:
      tmp+=inputs[no]+(10-inputs[no]%10)
    else:
      tmp+=inputs[no]
  if ans>tmp:
    ans=tmp
print(ans)