import math
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
li=[A,B,C,D,E]
li_ceil=[math.ceil(A/10)*10,math.ceil(B/10)*10,math.ceil(C/10)*10,math.ceil(D/10)*10,math.ceil(E/10)*10]
li_fi=[int(str(A)[-1]),int(str(B)[-1]),int(str(C)[-1]),int(str(D)[-1]),int(str(E)[-1])]
min_=9
num=9
ans=0
for i in range(len(li_fi)):
  if li_fi[i]<min_ and li_fi[i]!=0:
    min_=li_fi[i]
    num=i
for i in range(len(li)):
  if i==num:
    ans+=li[i]
  else:
    ans+=li_ceil[i]
print(ans)