a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

min = 9
min_index = -1
time = 0

data = []

data.append(a)
data.append(b)
data.append(c)
data.append(d)
data.append(e)

for i in range(0, 5):
	if data[i] % 10 < min and data[i] % 10 > 0:
		min = data[i] % 10
		min_index = i
for i in range(0, 5):
	if i == min_index:
		continue
	if data[i] % 10 == 0:
		time += data[i]
	else:
		time += ((int(data[i] / 10) + 1) * 10)
	
print(time + data[min_index])