A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
if A%10 == 0:
	aw = A
else:
	aw = int(A/10)*10 + 10
if B%10 == 0:
	bw = B
else:
	bw = int(B/10)*10 + 10
if C%10 == 0:
	cw = C
else:
	cw = int(C/10)*10 + 10
if D % 10 == 0:
	dw = D
else:
	dw = int(D/10)*10 + 10
if E % 10 == 0:
	ew = E
else:
	ew = int(E/10)*10 + 10
V1 = [A,B,C,D,E]
V2 = [aw,bw,cw,bw,ew]
V3 = [V2[j] - V1[j] for j in range(0,5)]
mx = V3.index(max(V3))
print(aw + bw + cw + dw + ew - V2[mx] + V1[mx])
