char s[];f(u){int i=0,j,k,t,a=0;for(;s[j=i];++i)for(;u>>i&s[i]!=48&&s[k=++j];)for(;u>>j&s[i]!=s[j]&&s[++k];)u>>k&s[j]==s[k]&&a<(t=(s[i]-48)*100+(s[j]-48)*10+s[k]-48+f(u^1<