nums = []
flg = True
for _ in range(5):
    nums.append(int(input()))
amaris = [i%10 for i in nums]
amaris_ = [abs(i%10-1) for i in nums]
minnum = min(amaris_)+1

count = 0
amari_count = 0
for num,amari in zip(nums,amaris):
    if amari == 0:
        count += num
        amari_count += 1
    else:
        count += (num//10+1)*10
if amari_count == 5:
    print(sum(nums))
else:  
    print(count+minnum-10)