a, b, c, d, e = [int(input()) for i in range(5)]
list = [a, b, c, d, e]
nlist = [a%10, b%10, c%10, d%10, e%10]
nlist.remove('0')

#mod10で並べた数字のうち最小のものを削除
nlist.sort() 
nlist.remove(0)
mlist = map(10 - nlist)
Sum = sum(list) + sum(mlist)
print (Sum)