five_dish = [int(input()) for _ in range(5)]
idx = None
maxdiff = 0
result = 0
for i in range(len(five_dish)):
    tmp = five_dish[i] % 10
    if tmp == 0:
        continue
    else:
        if 10 - tmp >= maxdiff:
            maxdiff = 10 - tmp
            idx = i
        else:
            continue
for j in range(len(five_dish)):
    if j == idx:
        continue
    else:
        if five_dish[j] % 10 == 0:
            result += five_dish[j]
        else:
            result += five_dish[j] + (10 - five_dish[j] % 10)
result += five_dish[idx]
print(result)
