menu = []
for i in range(0, 5):
	menu.append(int(raw_input()))

queue = [[0, menu]]
min = 1000
while queue != []:
	now = queue.pop(0)
	if now[1] == []:
		if now[0] < min: min = now[0]
	else:
		for i in range(0, len(now[1])):
			newmenu = []
			for j in range(0, len(now[1])):
				if i != j: newmenu.append(now[1][j])
			t = now[0]
			if t % 10 != 0:
				t = (t / 10 + 1) * 10
			t += now[1][i]
			queue.append([t, newmenu])

print min