ans = 0
used = False
mins = [int(input()) for _ in range(5)]
m = min(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
for menu in mins:
  if used==False and menu==m[1]:
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])