import math
n = [int(input()) for i in range(5)]
hld = 9
answer = 0
zaro_count = 1
for i in n:
  last_dig = i % 10
  if last_dig <= hld:
    hld = last_dig
    if last_dig == 0:
      zero_count += 1
  answer += math.ceil(i/10)*10
print(answer - 10*zero_count + hld)