A = [int(input()) for _ in range(5)]
mini = 9
for i in [j for j in A if j%10 != 0]:
    mini = min(mini,i%10)
print(mini)
ans = 0
for i in A:
    if i%10==0:
        ans += i
    else:
        ans += (i//10+1)*10
print(ans-10+mini)