a=[0]*5
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
amari=10
for i in range(5):
  if a[i]%10!=0:
    tmp=a[i]%10
  else:
    tmp=10
  amari=min(amari,tmp)
  a[i]=round(a[i],-1)
print(sum(a)-10+amari)