#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}, dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
inline void cn(long& n) {
  n = 0;
  long ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  n = n * sign;
}
template <class T>
void cmin(T& a, T b) {
  if (b < a) a = b;
}
template <class T>
void cmax(T& a, T b) {
  if (b > a) a = b;
}
template <class T>
int len(const T& c) {
  return (int)c.size();
}
template <class T>
int len(char c[]) {
  return (int)strlen(c);
}
string itos(long n) {
  string s;
  while (n) {
    s += (n % 10 + 48);
    n /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
long stoi(string s) {
  long n = 0;
  for (int i(0), _n(len(s)); i < _n; ++i) n = n * 10 + (s[i] - 48);
  return n;
}
int main() {
  string s;
  cin >> s;
  map<char, int> m;
  int k = 10, ar[100005];
  for (int i(0), _n(len(s)); i < _n; ++i) {
    if (s[i] == '?')
      ar[i] = 10;
    else if (isdigit(s[i]))
      ar[i] = 1;
    else {
      if (m[s[i]] == 0) {
        ar[i] = k;
        m[s[i]] = k;
        k--;
      } else
        ar[i] = 1;
    }
  }
  long long res = 1;
  for (int i(0), _n(len(s)); i < _n; ++i) {
    if (i == 0)
      res = res * min(9, ar[i]);
    else
      res = res * ar[i];
  }
  cout << res;
  return 0;
}
