#include<bits/stdc++.h>
#define maxn 1000005
#define inf 0x7fffffffffff
#define mod 1000000007
#define mst(a,x) memset(a,x,sizeof(a))
#define up(l,r,i) for(LL i=l;i<=r;i++)
#define down(l,r,i) for(LL i=l;i>=r;i--)
#define in(l,r,a) for(LL i=l;i<=r;i++)cin>>a[i]
#define out(l,r,a) for(LL i=l;i<=r;i++)cout<<a[i]<<" "
#define injz(n,m,a) for(LL i=1;i<=n;i++)for(LL j=1;j<=m;j++)cin>>a[i][j]
#define st(a,n) sort(a+1,a+n+1)
#define endl "\n"
#define hh cout<<endl
#define pb push_back
#define cf cin>>T;while(T--)
#define xh(n) U=n;while(U--)
#define cfout(x) cout<<(x?"YES":"NO")<<endl
#define cs cout<<"qaq"<<endl
typedef long long LL;LL T,U;
typedef double db;
using namespace std;
LL ans,a[10];
string s,ok;
vector<LL>qaq;
char tat[10];
map<string,LL>mp;
void solve()
{
    if(qaq.size()==4)
    {
        mst(a,0);
        string qwq="";
        for(LL i:qaq)
        {
            qwq+=to_string(i);
            a[i]++;
        }
        LL ansnow=24;
        up(0,9,i)
        {
            if(!a[i])continue;
            LL now=1;
            up(1,a[i],j)now*=j;
            ansnow/=now;
        }
        up(0,3,i)tat[i]=qwq[i];
        sort(tat,tat+4);
        up(0,3,i)qwq[i]=tat[i];
        if(!mp[qwq])
        {
            mp[qwq]++;
            ans+=ansnow;
        }
        return;
    }
    up(0,9,i)
    {
        if(s[i]=='o'||s[i]=='?')
        {
            qaq.pb(i);
            solve();
            qaq.pop_back();
        }
    }
    return;
}
int main()
{
    ios::sync_with_stdio(false);
    #ifdef ONLINE_JUDGE
    #else
    //freopen("bwxnQAQin.txt","r",stdin);
    //freopen("bwxnQAQout.txt","w",stdout);
    #endif
    cin>>s;
    LL ok=0;
    up(0,9,i)
    {
        if(s[i]=='o')
        {
            ok++;
            qaq.pb(i);
        }
    }
    if(ok>4)
    {
        cout<<"0"<<endl;
        exit(0);
    }
    solve();
    cout<<ans<<endl;
    cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms";
    return 0;
}

/*  Solution By: 
    Ashish Kudar */ 
                                /* When you get down to nothing.. */
#include<bits/stdc++.h>
#define sync            ios_base::sync_with_stdio(0);cin.tie(NULL);
#define ll              long long
#define ull             unsigned ll
#define ld              long double
#define pii             pair<int,int>
#define pll             pair<ll,ll> 
#define vi              vector<int> 
#define vll             vector<ll> 
#define vs              vector<string>
#define vb              vector<bool>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<ll,ll>>
#define vvi             vector<vector<int>>
#define vvll            vector<vector<ll>>
#define all(x)          x.begin(),x.end()
#define FOR(i,a,b)      for(int i=a;i<b;++i)
using namespace std; 
 
const int MAX=1e6+5;
const int mod=1e9+7;
const ld pi=acos(-1);

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string s,t;

ll calcNoOfStrings(string res,ll pos){
    if(pos == 4){
        t=s;
        FOR(i,0,s.length()){
            if(s[i] == 'o') t[i]='0';
            else if(s[i] == 'x')    t[i]='1';
            else    t[i]='1';
        }
        FOR(i,0,4){
            if(s[res[i]-'0'] == 'o')
                t[res[i]-'0']='1';
            else if(s[res[i] -'0'] == 'x')
                t[res[i]-'0']='0';
        }
        if(t == string(10,'1')){
            return 1;
        }else
            return 0;
    }
    ll ans=0;
    FOR(i,0,10){
        res[pos]=i+'0';
        ans+=calcNoOfStrings(res,pos+1);
    }
    return ans;
}

int main(){
    // #ifndef ONLINE_JUDGE 
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    clock_t clk = clock();
    sync 
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;++t){
        // test cases starts here
        cin>>s;
        string ans(4,'X');
        cout<<calcNoOfStrings(ans,0)<<endl;
       
        // cout<<"Case #"<<t<<": ";   
    }

    // cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
}

                                /* God is always upto something! */
