import sys readline=sys.stdin.readline S=readline().rstrip() N=len(S) cnt0=S.count("0") cnt1=S.count("1") inve=sum(1 for i in range(N) for j in range(i+1,N) if S[i]>S[j]) dp=[[[0]*(inve+1) for c1 in range(cnt1+1)] for c0 in range(cnt0+1)] dp[0][0][0]=1 for c0 in range(cnt0+1): for c1 in range(cnt1+1): for i in range(inve+1): if c0 and 0<=i-c1: dp[c0][c1][i]+=dp[c0-1][c1][i-c1] if c1: dp[c0][c1][i]+=dp[c0][c1-1][i] ans=dp[cnt0][cnt1][inve] print(ans)