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

mm = ae[0]%10
for i in range(5):
    mm = min(mm, ae[i]%10)
    if ae[i]%10 != 0:
        ae[i] = ((ae[i]//10)+1)*10
if mm != 0:
    print(sum(ae)-(10-mm))
else:
    print(sum(ae))