L[101],S[101],v[101],e,s,p,m,x;f(i){v[i]||(v[i]=p,x+=m=L[i],v[s=S[i]]==p?e=s:f(s));L[i]