A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
list1=[A,B,C,D,E]
sum=0
for item in list1:
  if(item%10==0):
    sum+=item
  else:
    sum=sum+item+(10-item%10)
list1[0]=list1[0]%10
list1[1]=list1[1]%10
list1[2]=list1[2]%10
list1[3]=list1[3]%10
list1[4]=list1[4]%10
min=min(list1)
sum-=min
print(sum)