#include <bits/stdc++.h>
char c[100005], b[100005];
long of[12][100000], digit;
long ask = 0, str[100005];
bool sign[15];
int main() {
  long n, i, j, t, result = 1, k, now = 10;
  bool have;
  scanf("%s", c);
  n = strlen(c);
  if (c[0] >= 'A' && c[0] <= 'J') {
    result *= 9;
    sign[c[0] - '0' - 17] = true;
    now = 9;
  }
  if (c[0] == '?') {
    result *= 9;
  }
  for (i = 1; i < n; i++) {
    if (c[i] >= 'A' && c[i] <= 'J') {
      if (sign[c[i] - '0' - 17] == false) {
        result *= now;
        sign[c[i] - '0' - 17] = true;
        now--;
      }
    }
    if (c[i] == '?') ask++;
  }
  printf("%ld", result);
  for (i = 1; i <= ask; i++) printf("0");
  printf("\n");
}
