time = []
for i in range(5):
  time.append(int(input()))
  
time_diff = [10-(i%10) for i in time]
time_ten = [i+10-i%10 for i in time]

max_diff = time_diff.index(max(time_diff))

ans = sum(time_ten) - time_ten[max_diff] + time[max_diff]

print(ans)