times = [int(input()) for i in range(5)]
rest = [times[i] % 10 for i in range(len(times))]
m = rest.index(min(rest))
total = 0
for n in range(len(times)):
    if n == m:
        total += times[n]
    else:
        total += ((times[n]+9) // 10) * 10

print(total)