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);s>10?x++,n[s]++:0)s=getchar();for(;--i;x-=j)s=s*a[x][j=n[i]]%m;i=!printf("%d",(m-s-1)%m);}