#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000")
using namespace std;
template <class T>
T inline sqr(T x) {
  return x * x;
}
const double pi = 3.1415926535897932384626433832795;
const double eps = 1e-8;
int main() {
  string s;
  cin >> s;
  if (s.length() == 1) {
    if (isdigit(s[0]))
      cout << "1";
    else
      cout << "9";
    return 0;
  }
  map<char, int> M;
  int q = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?') {
      q++;
      continue;
    }
    if (s[i] >= '0' && s[i] <= '9') continue;
    M[s[i]]++;
  }
  long long ans = 1;
  if (s[0] == '?') ans *= 9, q--;
  for (int i = 0; i < M.size(); i++) ans *= (10 - i);
  if (s[0] >= 'A' && s[0] <= 'J') ans = (ans / 10) * 9;
  cout << ans;
  int q10 = q;
  for (int i = 0; i < q10; i++) cout << "0";
  return 0;
}
