/* @memendra_singh */
#include<bits/stdc++.h>
using namespace std;
#define m7          1000000007
#define m9          1000000009
#define ll          long long
#define boost       ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define F           first
#define S           second
#define pb          push_back
#define f1(i,n)     for(int i=0;i<n;i++)
#define all(c)      c.begin(),c.end()
#define ldb         long double
#define pi          acos(-1)

int main()
{
	boost;
	int t = 1;
	//cin>>t;
	while(t--)
	{
		string s;
		cin>>s;


		int ans = 0;
		for(int i=0;i<=9999;i++)
	    {
	    	vector<bool> arr(10,false);
	    	int x = i;
	    	for(int j=0;j<4;j++)
	    	{
	    		//int k = x%10;
	    		arr[x%10] = true;
	    		x = x/10;
	    	}

	    	bool flag = true;
	    	for(int j=0;j<10;j++)
	    	{
	    		if(s[j] == 'o' && arr[j]==false)
	    			flag = false;
	    		if(s[j] == 'x' && arr[j] == true)
	    			flag = false;
	    	}
	    	if(flag)
	    		ans++;
	    }
	    cout<<ans<<'\n';


	}
	return 0;
}
#include<bits/stdc++.h>
#define LOCAL
#define ft first
#define sd second
#define endl '\n'
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define weishu setprecision
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lowbit(x) ((x)&(-x))
#define debug1() cout<<"hello world!"<<endl
#define debug2() cout<<"hello"<<endl
#define RAND(a,b) (rand() % ((b)-(a)+1))+ (a)
#define SRAND srand((unsigned)time(NULL))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
const lld pi = acos(-1.0);
const ll maxn=1e5+5;
ll mod=123456789;

void init(void);
ll pow_mod(ll a,ll k);
ll ni(int x);
void get_prime();
//ll prime[maxn];
//bool v[maxn];
int a[11],c[11];
vector<int> b;
void solve(){
	string t;
	cin >> t;
	int len=t.size();
	for(int i=0;i<len;i++){
		if(t[i]=='o')b.push_back(i);
		else if(t[i]=='?')c[i]++;
	}	
	if(b.size()>=5){
		cout<<0<<endl;
	}
	else{
		int j,num=0,ans=0;
		for(int i=0;i<=9999;i++){
			for(int k=0;k<11;k++)a[k]=0;
			j=i;
			num=4;
			while(j){
				a[j%10]++;
				j/=10;
				num--;
			}
			a[0]+=num;
			int flag=1;
			for(int k=0;k<b.size();k++){
				if(a[b[k]]!=0)a[b[k]]=0;
				else{
					flag=0;
					break;
				}
			}
			if(flag==1){
				for(int i=0;i<10;i++){
					if(a[i]!=0){
						if(c[i]!=0)continue;
						else{
							flag=0;
							break;	
						}
					}
				}
			}
			if(flag==1)ans++;
		}
		cout<<ans<<endl;
	}
} 

	
	
signed main(){
	io;
    //init();
    //get_prime();
    ll T=1;
    //cin >> T;
    while(T--){
    	solve();
	}
    return 0;
} 









void init (void)
{
    #ifdef LOCAL
        freopen ("data.txt", "w", stdout);
    #endif
}

ll pow_mod(ll a,ll k)
{
    ll ans = 1;
    a %= mod;
    while(k)
    {
        if(k & 1) ans *= a;
        a = (a * a) % mod;
        k >>= 1;
        ans %= mod;
    }
    return ans % mod;
}

ll ni(int x){
    return pow_mod(x,mod-2);
}

//void get_prime(){ 
//    int count = 1;  
//    for (int i = 2; i<maxn; i++){    
//        if(!v[i]){
//            prime[count++] = i;      
//        }      
//        for (int t = 1;  prime[t] * i < maxn &&t<count; t++){
//            v[prime[t] * i] = 1;
//            if(i % prime[t] == 0)
//                break;      
//        }  
//    }
//}
