list = list(int(input()) for _ in range(5))
ans = 0
tag = 9
for i in range(5):
  if list[i]%10==0:
    ans+=list[i]
  else:
    ans+=list[i]+(10-(list[i]%10))
    if tag>list[i]%10:
      tag = list[i]%10
print(ans-(10-tag))
  