/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

void solve() {
	string s;
	cin>>s;
	
	int cnt = 0;
	for(int i=9999;i>=0;i--) {
		string snum = to_string(i);
		int pad_len = 4 - snum.length();
		if(pad_len > 0) {
			string pad = string(pad_len, '0');
			snum = pad + snum;
		}
		//~chk(snum);
		
		bool possible = true;
		int f[10] = {0};
		for(int j=0;j<snum.length();j++) {
			f[snum[j]-'0']++;
		}
		
		for(int j=0;j<s.length();j++) {
			if(s[j] == 'o' && f[j] == 0) {possible = false; break;}
			if(s[j] == 'x' && f[j] > 0) {possible = false; break;}
		}
		
		if(possible) cnt++;
	}
	
	cout<<cnt<<en;
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define testcases \
    int t;        \
    cin >> t;     \
    while (t--)
#define rep(i, j, k) for (int i = j; i <= k; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define pi 3.14159265358979323846
#define mod 1000000007

int32_t main()
{
    boost;
    string s;
    cin >> s;
    set<int> x_count, o_count, q_count;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '?')
            q_count.insert(i);
        else if (s[i] == 'o')
            o_count.insert(i);
        else
            x_count.insert(i);
    }
    string pin = "....";
    int ans = 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> vals;
                    bool flag = false;
                    pin[0] = '0' + i;
                    pin[1] = '0' + j;
                    pin[2] = '0' + k;
                    pin[3] = '0' + l;
                    for (int u = 0; u < 4; u++)
                    {
                        vals.insert(pin[u] - '0');
                    }
                    for (auto u : vals)
                    {
                        if (o_count.find(u) == o_count.end() && q_count.find(u) == q_count.end())
                        {
                            flag = true;
                            break;
                        }
                    }
                    for (auto u : o_count)
                    {
                        if (vals.find(u) == vals.end())
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (flag == false)
                        ans++;
                }
            }
        }
    }
    cout << ans;
}