A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
T = []
a=A%10
b=B%10
c=C%10
d=D%10
e=E%10

if a==0:
	AA=round(A,-1)
elif a>=5:
	AA=round(A,-1)
else:
	AAA=A+5
	AA=round(AAA,-1)
	T.append(a)

if b==0:
	BB=round(B,-1)
elif b>=5:
	BB=round(B,-1)
else:
	BBB=B+5
	BB=round(BBB,-1)
	T.append(b)

if C==0:
	CC=round(C,-1)
elif c>=5:
	CC=round(C,-1)
else:
	CCC=C+5
	CC=round(CCC,-1)
	T.append(c)

if d==0:
	DD=round(D,-1)
elif d>=5:
	DD=round(D,-1)
else:
	DDD=D+5
	DD=round(DDD,-1)
	T.append(d)

if e==0:
	EE=round(E,-1)
elif e>=5:
	EE=round(E,-1)
else:
	EEE=E+5
	EE=round(EEE,-1)
	T.append(e)

if min(T)==a:
	print(A+BB+CC+DD+EE)
elif min(T)==b:
	print(AA+B+CC+DD+EE)
elif min(T)==c:
	print(AA+BB+C+DD+EE)
elif min(T)==d:
	print(AA+BB+CC+D+EE)
else:
	print(AA+BB+CC+DD+E)

