ts = [int(raw_input()) for i in range(5)]

def up(i):
    one = int(str(i)[-1])
    if one == 0:
        return i
    else:
        return i + (10 - one)

t = sum([up(i) for i in ts])
ones = [int(str(s)[-1]) for s in ts]
while True:
    try:
        ones.remove(0)
    except:
        break
if not len(ones) == 0:
	m = min(ones)
	print int(t-(10-m))
else:
  	print int(t)