#include <bits/stdc++.h>
using namespace std;
__inline bool nextInt(int &val) {
  char ch;
  int sgn = 1;
  while ((ch = getchar()) != EOF) {
    if (ch == '-') sgn = -1;
    if (ch >= '0' && ch <= '9') break;
  }
  if (ch == EOF) return false;
  val = (int)(ch - '0');
  while (true) {
    ch = getchar();
    if (ch >= '0' && ch <= '9') {
      val = 10 * val + (int)(ch - '0');
    } else
      break;
  }
  val *= sgn;
  return true;
}
__inline bool nextString(string &s) {
  char ch;
  while ((ch = getchar()) != EOF) {
    if (ch >= 33 && ch <= 126) break;
  }
  if (ch == EOF) return false;
  s = string(1, ch);
  while (true) {
    ch = getchar();
    if (ch >= 33 && ch <= 126) {
      s = s + string(1, ch);
    } else
      break;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  char code[333888];
  gets(code);
  int codeLen = strlen(code), numq = 0, mask = 0;
  for (int i = 0; i < (codeLen); i++) {
    if (code[i] == '?')
      numq++;
    else if (code[i] >= 'A' && code[i] <= 'J')
      mask |= (1 << (code[i] - 'A'));
  }
  if (code[0] == '0') {
    cout << 0 << endl;
    return 0;
  }
  long long ret = 1;
  if (code[0] == '?') {
    ret *= 9;
    numq--;
  }
  int maskSize = __builtin_popcount(mask), left = 10;
  if (code[0] >= 'A' && code[0] <= 'J') {
    ret *= 9;
    maskSize--;
    left--;
  }
  for (int i = 0; i < (maskSize); i++) {
    ret *= left;
    left--;
  }
  cout << ret << string(numq, '0') << endl;
  return 0;
}
