dishes=[]
mindiv=10

for i in range(5):
  dishes.append(int(input()))

for j in range(len(dishes)):
  k= dishes[j]
  if(k%10 ==0 ):
    continue
  if(k%10 <mindiv):
    mindiv= k%10
  if(k%10 <5 ):
    k += 5
  dishes[j]= round(k,-1)
  
print(dishes)
print(mindiv)
print(sum(dishes)-(10-mindiv))