#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) begin(v), end(v)
using namespace std;
using P = pair<int,int>;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

ll ll_pow(ll a, ll n) {
  ll ans = 1;
  for(ll i = 0; i < n; i++) ans *= a;
  return ans;
}

int main() {
  string s;
  int ans = 0; 
  cin >> s;
  
  vi num(10);
  vi num_n(10);
  
  rep(i,10){
    if(s[i] == 'o') num[i]=2;
    else if(s[i] == '?') num[i]=1;
    else num[i] = 0;
  }
  
  rep(i,10000){
    
    rep(k,10) num_n[k] = 0;
    
    num_n[(i/1000)%10]++;
    num_n[(i/100)%10]++;
    num_n[(i/10)%10]++;
    num_n[i%10]++;
    
    int flag = 0;
    flag = 0;
    
  rep(k,10){
        if(num_n[k] > 0 && num[k] == 0) flag = 1;
        if(num_n[k] == 0 && num[k] == 2) flag = 1;
    }
     if(flag == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
#define pd push_back
#define sort(v) sort(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end(),greater<int>())
#define display(s) for(auto val:s) cout<<val<<" "; cout<<endl;
#define displayMap(mymap) for(auto val:mymap) cout<<val.first<<" -> "<<val.second<<endl;
#define Sortcom(v) sort(v.begin(),v.end(),mycompare) 
#define f(a,b,c) for(int i=a;i<b;i+=c)

bool mycompare(int a,int b)
{
    return a<b;
}

int mod(int x)
{
    return (x%MOD+MOD)%MOD;
}
int mul(int a,int b)
{return mod(mod(a)*mod(b));}
int add(int a,int b)
{return mod(mod(a)+mod(b));}

int power(int a,int b)
{
    if(b==0)
    return 1;
    int smallans = power(a,b/2);
    smallans = smallans * smallans;
    if(b&1)
    smallans = smallans * a;
    return smallans;    
}

bool check(string s, int i,int j,int k, int l)
{
    map<int,int> mymap;
    mymap[i]++; mymap[j]++; mymap[k]++; mymap[l]++;
    for(int i=0;s[i];i++)
    {
        if(s[i] == 'o' && mymap[i]<=0)
        return false;
        if(s[i] == 'x' && mymap[i]>0)
        return false;
    }
    return true;
}

int solve(){
    string s; cin>>s;
    int a=0,b=0,c=0;
    for(int i=0;s[i];i++)
    {
        if(s[i] == 'o') a++;
        else if(s[i] == 'x') b++;
        else c++;
    }
    int ans = 0;
    if(a>4) return ans;
    for(int i=0;i<10;i++)
    {
        for(int j=0;j<10;j++)
        {
            for(int k=0;k<10;k++)
            {
                for(int l = 0;l<10;l++)
                {
                    if(check(s,i,j,k,l))
                    ans++;
                }
            }
        }
    }
    return ans;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;  t=1;
    // int t; cin>>t;
    while(t--)
    {
        // solve();
        cout<<solve()<<endl;
    }
    return 0;
}
/*
if((s[i] == 'o' || s[i] == '?') && (s[j] == 'o' || s[j] == '?') &&
                    (s[k] == 'o' || s[k] == '?') && (s[l] == 'o' || s[l] == '?'))
*/