a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dish = [a,b,c,d,e]
time = [0,0,0,0,0]
reg = 0
mini = 10

for l in range(5):
  num = dish[l]%10
  print(num)
  if num == 0:
    time[l] = dish[l]
  else:
    time[l] = (dish[l]//10+1)*10
    
  if num != 0 and num < mini:
    mini = num
    reg = l
        
if reg ==0:
  print(a+time[1]+time[2]+time[3]+time[4])
elif reg == 1:
  print(time[0]+b+time[2]+time[3]+time[4])
elif reg == 2:
  print(time[0]+time[1]+c+time[3]+time[4])
elif reg == 3:
  print(time[0]+time[1]+time[2]+d+time[4])
elif reg == 4:
  print(time[0]+time[1]+time[2]+time[3]+e)