n[999],a[1010][1010],m=573,x,i,j;main(s){for(**a=1;i+j--?a[i][-j]=a[i-1][-j]+a[i-1][~j]%m,1:(j=i++<999);n[s]++)s=getchar(x+=s>10);for(;--i>10;x-=j)s=s*a[x][j=n[i]]%m;i=!printf("%d",(m-s-1)%m);}