#include <bits/stdc++.h>

// clang-format off
using namespace std;
class Rep{struct I{int i;void operator++(){++i;}int operator*(){return i;}bool operator!=(I o){return i<*o;}}b,e;
public:Rep(int l,int r):b{l},e{r}{}Rep(int n):Rep(0,n){}I begin(){return b;}I end(){return e;}};
class Per{struct I{int i;void operator++(){--i;}int operator*(){return i;}bool operator!=(I o){return i>*o;}}b,e;
public:Per(int l,int r):b{r-1},e{l-1}{}Per(int n):Per(0,n){}I begin(){return b;}I end(){return e;}};
template<class F>struct Fix:F{Fix(F f):F(f){}
template<class...T>decltype(auto)operator()(T&&...a){return F::operator()(*this,forward<T>(a)...);}};
template<class T=int>T scan(){T r;cin>>r;return r;}
template<class T,class U=T>bool chmin(T&a,U&&b){return b<a?a=forward<U>(b),1:0;}
template<class T,class U=T>bool chmax(T&a,U&&b){return a<b?a=forward<U>(b),1:0;}
#ifndef LOCAL
#define DUMP(...) void(0)
#endif
#define ALL(c) begin(c), end(c)
// clang-format on

main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  auto s = scan<string>();
  int ans = 0;
  for (int i : Rep(10000)) {
    vector<bool> exists(10);
    for (int _ = 4; _--;) {
      exists[i % 10] = true;
      i /= 10;
    }
    ans += [&]() -> bool {
      for (int x : Rep(10)) {
        if (s[x] == 'o' and not exists[x]) return false;
        if (s[x] == 'x' and exists[x]) return false;
      }
      return true;
    }();
  }
  cout << ans << '\n';
}

#include <iostream>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
  string s;
  cin >> s;

  int r = 0;

  map<int, int> c;

  int d[10] = {};

  for (int i = 0; i < 10; i++)
  {
    if (s[i] == 'o')
    {
      c[i] = 1;
      d[i] = 1;
      r++;
    }
    else if (s[i] == '?')
    {
      d[i] = 1;
    }
  }

  if (c.size() > 4)
  {
    cout << 0;
    return 0;
  }

  int sum = 0;

  for (int i = 0; i < 10; i++)
  {
    for (int j = 0; j < 10; j++)
    {
      for (int k = 0; k < 10; k++)
      {
        for (int h = 0; h < 10; h++)
        {
          int temp = 0;
          if (c[i])
            temp++;
          if (i != j && c[j])
            temp++;
          if (k != j && k != i && c[k])
            temp++;
          if (h != i && h != j && h != k && c[h])
            temp++;

          if (temp == r)
          {
            if (d[i] + d[j] + d[k] + d[h] == 4)
            {
              sum++;
            }
          }
        }
      }
    }
  }

  cout << sum << endl;
}