#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 1e9 + 7;

vector<int> v = {1, 1, 2, 6, 24};
int ans = 0;
vector<int> v1;
int n;

void fun(int x, int c, vector<int> a)
{
  if(c == 4)
  {
    int t1 = 24;
    for(int i = 0; i < 10; i++)
      t1 /= v[a[i]];
    ans += t1;
    return;
  }
  if(x >= n | c > 4)
    return;
  fun(x+1, c, a);
  a[v1[x]]++;
  fun(x+1, c+1, a);
  a[v1[x]]++;
  fun(x+1, c+2, a);
  a[v1[x]]++;
  fun(x+1, c+3, a);
  a[v1[x]]++;
  fun(x+1, c+4, a);
  a[v1[x]] -= 4;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << setprecision(20) << fixed;

	string s;
	cin >> s;
	int c = 0;
	int i = 0;
	vector<int> a(10, 0);
	for(char x : s)
  {
	  if(x == 'o')
	  {
	    c++;
	    a[i]++;
	  }
	  if(x == 'o' || x == '?')
	   v1.push_back(i);
	 i++;
  }
  n = v1.size();
	fun(0, c, a);
	cout << ans << endl;
	
	return 0;
}

/*
	Author : $%U%$
	Time : $%h%$:$%m%$:$%s%$, $%D%$/$%M%$/$%Y%$
*/


#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!

using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>; 
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>; 
using vpd = vector<pd>;

#define tcT template<class T
#define tcTU tcT, class U
// ^ lol this makes everything look weird but I'll try it
tcT> using V = vector<T>; 
tcT, size_t SZ> using AR = array<T,SZ>; 
tcT> using PR = pair<T,T>;

// pairs
#define mp make_pair
#define f first
#define s second

// vectors
// oops size(x), rbegin(x), rend(x) need C++17
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend() 
#define sor(x) sort(all(x)) 
#define rsz resize
#define ins insert 
#define ft front()
#define bk back()
#define pb push_back
#define eb emplace_back 
#define pf push_front

#define lb lower_bound
#define ub upper_bound 
tcT> int lwb(V<T>& a, const T& b) { return int(lb(all(a),b)-bg(a)); }

// loops
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18; // not too close to LLONG_MAX
const db PI = acos((db)-1);
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

// bitwise ops
// also see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set
constexpr int bits(int x) { // assert(x >= 0); // make C++11 compatible until USACO updates ...
	return x == 0 ? 0 : 31-__builtin_clz(x); } // floor(log2(x)) 
constexpr int p2(int x) { return 1<<x; }
constexpr int msk2(int x) { return p2(x)-1; }

ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down

tcT> bool ckmin(T& a, const T& b) {
	return b < a ? a = b, 1 : 0; } // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }

tcTU> T fstTrue(T lo, T hi, U f) {
	hi ++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		T mid = lo+(hi-lo)/2;
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}
tcTU> T lstTrue(T lo, T hi, U f) {
	lo --; assert(lo <= hi); // assuming f is decreasing
	while (lo < hi) { // find first index such that f is true 
		T mid = lo+(hi-lo+1)/2;
		f(mid) ? lo = mid : hi = mid-1;
	} 
	return lo;
}
tcT> void remDup(vector<T>& v) { // sort and remove duplicates
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
tcTU> void erase(T& t, const U& u) { // don't erase
	auto it = t.find(u); assert(it != end(t));
	t.erase(it); } // element that doesn't exist from (multi)set

#define el '\n'


void solve()
{
	str st; cin>>st;
    int ans = 0;
    for(int i=0;i<=9999;i++)
    {
        bool arr[10];
        memset(arr,false,sizeof(arr));
        int temp = i;
        for(int j=0;j<4;j++)
        {
            arr[temp%10] = true;
            temp /= 10;
        } 
        bool flag = true;
        for(int j=0;j<10;j++)
        {
            
            if(st[j]=='o' and !arr[j]) flag = false;
            if(st[j]=='x' and arr[j]) flag = false;
        }
        ans += flag;
    }
    cout<<ans;

}

int main() 
{ 
    cin.tie(0)->sync_with_stdio(0);
    
    int ct=1;
    // cin>>ct;
    while(ct--)
    {
        solve();
    } 

}