#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[100020];
  int t, i, j, len, arr[26] = {0}, mult = 1, ques = 0, count = 10;
  scanf("%s", str);
  len = strlen(str);
  if (str[0] == '?')
    mult *= 9;
  else if (str[0] >= 'A' && str[0] <= 'J') {
    mult *= 9;
    count--;
    arr[str[0] - 'A'] = -1000000;
  }
  for (i = 1; i < len; i++) {
    if (str[i] >= '0' && str[i] <= '9')
      continue;
    else if (str[i] >= 'A' && str[i] <= 'J')
      arr[str[i] - 'A']++;
    else if (str[i] == '?')
      ques++;
  }
  for (i = 0; i < 10; i++) {
    if (arr[i] > 0) {
      mult *= count;
      count--;
    }
  }
  printf("%d", mult);
  for (i = 0; i < ques; i++) printf("0");
  printf("\n");
  return 0;
}
