import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } Scanner sc = new Scanner(); void run() { char[] cs=sc.next().toCharArray(); long[] dp=new long[1<<12]; for(int s=0;s<1<<12;++s) { for(int i=0;i0)continue; for(int j=i+1;j0)continue; for(int k=j+1;k0)continue; if(cs[i]=='0'||cs[j]!=cs[k]||cs[i]==cs[j])continue; int add=(int)(cs[i]-'0')*100+(int)(cs[j]-'0')*10+(int)(cs[k]-'0'); int ns=s|1<