dish=[int(input()) for i in range(5)]
dish_s=[(dish[i]+9)//10 for i in range(5)]
dish_d=[dish[i]%10 for i in range(5)]
sum=0
for i in range(5):
  sum+=dish_s[i]
min=9
for i in range(5):
  if dish_d[i]!=0 and dish_d[i]<min:
    min=dish_d[i]  
print((sum-1)*10+min)