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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    // cout << fixed << setprecision(5);

    std::string S;
    std::cin >> S;

    ll size = S.size();

    ll Maru = 0;
    ll Hatena = 0;

    for (ll i = 0; i < size; i++) {
        if (S.at(i) == 'o') {
            Maru++;

        } else if (S.at(i) == '?') {
            Hatena++;
        }
    }

    //cout << Maru << endl;
    //cout << Hatena << endl;

    if (Maru > 4) {
        cout << 0 << endl;
    }

    else if (Maru == 4) {
        cout << 24 << endl;
    }

    else if (Maru == 3) {
        cout << 36 + 24 * Hatena << endl;
    }

    else if (Maru == 2) {
        cout << 14 + 36 * Hatena + 24 * Hatena * (Hatena - 1)/2 << endl;
    }

    else if (Maru == 1) {
        cout << 1 + 14 * Hatena + 36 * Hatena * (Hatena - 1)/2 + 24 * Hatena * (Hatena - 1) * (Hatena - 2)/6 << endl;
    }

    else if (Maru == 0) {
        cout << Hatena + 14 * Hatena * (Hatena - 1)/2 + 36 * Hatena * (Hatena - 1) * (Hatena - 2)/6 +
                    24 * Hatena * (Hatena - 1) * (Hatena - 2) * (Hatena - 3)/24
             << endl;
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

#define f first
#define s second
#define pb push_back

#define all(x) x.begin(), x.end()
#define mp(x, y) make_pair(x, y)
#define sz(li) (int) (li).size()
#define sum(a) (accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a) (*min_element((a).begin(), (a).end()))
#define maxe(a) (*max_element((a).begin(), (a).end()))
#define mini(a) (min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a) (max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) (lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) (upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pll>

#define endl "\n"

template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) { cout << "[ "; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << " ]"; }
template<typename A> ostream& operator<<(ostream &cout, vector<vector<A>> const &v) { cout << "["; for (int i = 0; i < v.size(); i++) { if (i) { cout << " "; } cout << v[i]; if (i < v.size() - 1) { cout << endl; } } return cout << "]"; }
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) { cin >> p.first; return cin >> p.second; }
template<typename T, typename U> void cmin(T& a, U b){ if (a > b) a = b; }
template<typename T, typename U> void cmax(T& a, U b){ if (a < b) a = b; }

void solve() {
  string s; cin >> s;

  auto check = [&](int n) {
    string num = to_string(n);

    if (sz(num) != 4) {
      reverse(all(num));

      while (sz(num) != 4) {
        num += '0';
      }
  
      reverse(all(num));      
    }


    bool flag1 = true;
    for (int i = 0; i <= 9; i++) {
      if (s[i] == 'o') {
        bool flag2 = false;
        for (char c : num) {
          flag2 |= (c - '0' == i);
        }

        flag1 &= flag2;
      }
    }

    for (char c : num) {
      flag1 &= (s[c - '0'] != 'x');
    }

    return flag1;
  };

  int ans = 0;

  for (int i = 0; i <= 9999; i++) {
    if (check(i)) {
      ans++;
    }
  }

  cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  int t = 1;
  // cin >> t;

  while (t--) {
    solve();
  }

  // cerr << "Time: " << 1000.0*clock()/CLOCKS_PER_SEC << " ms\n";
}