#include <bits/stdc++.h>
using namespace std;
int main() {
  char *s = new char[100001];
  bool alpha[10];
  int result = 1;
  for (int i = 0; i < 10; i++) {
    alpha[i] = true;
  }
  int nalpha = 0, nTen = 0;
  cin >> s;
  for (int i = 0, n = strlen(s); i < n; i++) {
    if (s[i] == '?') {
      if (i == 0)
        result = result * 9;
      else
        ++nTen;
    } else if (isdigit(s[i])) {
    } else {
      if (alpha[s[i] - 'A'] == false) {
      } else {
        if (i == 0)
          result = result * 9;
        else
          result = result * (10 - nalpha);
        alpha[s[i] - 'A'] = false;
        ++nalpha;
      }
    }
  }
  cout << result;
  for (int i = 0; i < nTen; i++) {
    cout << '0';
  }
  return 0;
}
