#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int M = 1e9+7;
ll mod(ll x){
    return (x%M + M)%M;
}

ll mul(ll a, ll b){
    return mod((mod(a)*mod(b)));
}

ll add(ll a , ll b){
    return mod(mod(a)+mod(b));
}


void solve(){
    string s;
    cin>>s;
    int ok=0;
    int maybe=0;
    for(auto i : s){
        if(i=='o') ok++;
        else if(i=='?') maybe++;
    }
    int total=0;
    for(int i=0;i<=9;i++){
        for(int j=0;j<=9;j++){
            for(int k=0;k<=9;k++){
                for(int l=0;l<=9;l++){
                    set<int>ss;
                    //i have to insure that that number of o's must have all the numbers
                    if(s[i]=='x' || s[j]=='x' || s[k]=='x' || s[l]=='x') continue;
                    if(s[i]=='o') ss.insert(i);
                    if(s[j]=='o') ss.insert(j);
                    if(s[k]=='o') ss.insert(k);
                    if(s[l]=='o') ss.insert(l);
                    if((int)ss.size()==ok) total++;
                }
            }
        }
    }
    cout<<total;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed;
    cout<<setprecision(10);
    int t=1;
    // cin>>t;
    for(int i=1;i<=t;i++){
        solve();
    }
    return 0;
}



#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   string s;
   cin>>s;

   int res=0;
   rep(num,0,10000){
      string key=to_string(num);
      while(key.size()<4)key.push_back('0');
      rep(d,0,10){
         if(s[d]=='o' and key.find((char)('0'+d))==string::npos){
            goto fail;
         }
         if(s[d]=='x' and key.find((char)('0'+d))!=string::npos){
            goto fail;
         }
      }
      res++;
      fail:;
   }
   cout<<res<<'\n';
   return 0;
}