import numpy as np, math
A = [int(input()) for _ in range(5)]
A.sort()
print([(i//10+1)*10 for i in A])
print(sum([math.ceil(i/10)*10 for i in A])  -max([10-i for i in [ (i % 10) for i in A] if i != 0]))

