me = [int(input()) for i in range(5)]


time = 0
flg = 0
for i in me:
    j = i%10
    if j == 0:
        k = i
    else:
        k = i+(10-j)
        if flg < 10-j:
            fig = 10-j
        else:
            pass
    time += k
    
k -= flg

print(k)