a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = 10 * ((a + 9) // 10)
bb = 10 * ((b + 9) // 10)
cc = 10 * ((c + 9) // 10)
dd = 10 * ((d + 9) // 10)
ee = 10 * ((e + 9) // 10)
x = min(set([a%10,b%10,c%10,d%10,e%10]) - {0})
print(x)
print(aa+bb+cc+dd+ee-(10-x))
