a = [int(input()) for _ in range(5)]
def ceil(x):
  if x % 10 != 0:
    return 10 * ((x // 10) + 1)
  else:
    return x
sum = 0
min = float('inf')
for i in range(5):
  sum = sum + ceil(a[i])
  if a[i] % 10 != 0 and a[i] % 10 < min:
    min = a[i] % 10
print(sum - 10 + min)