#include <bits/stdc++.h>
using namespace std;
int hasLetter[10];
int main() {
  int letters = 0, qmarks = 0, trailingLetter, trailingQmark, i;
  int c = getchar();
  trailingQmark = (c == '?');
  trailingLetter = (c >= 'A' && c <= 'J');
  while (1) {
    if (c >= '0' && c <= '9') {
    } else if (c == '?') {
      qmarks++;
    } else if (c >= 'A' && c <= 'J') {
      hasLetter[c - 'A'] = 1;
    } else
      break;
    c = getchar();
  }
  for (i = 0; i < 10; i++) {
    letters += hasLetter[i];
  }
  unsigned long r = 1;
  if (trailingQmark) {
    qmarks--;
    r *= 9;
  }
  if (trailingLetter) {
    r *= 9;
  }
  for (i = 0; i < qmarks; i++) r *= 10;
  for (i = 0 + trailingLetter; i < letters; i++) {
    r *= 10 - i;
  }
  printf("%d\n", r);
  return 0;
}
