#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, n;
  int num;
  char str[100010];
  scanf("%s", str);
  int len = strlen(str);
  int index[26];
  memset(index, 0, sizeof(index));
  num = 1;
  int numA = 0;
  if (str[0] > '0' && str[0] <= '9') {
    for (int i = 0; i < len; i++) {
      if (str[i] >= 'A' && str[i] <= 'J') {
        index[str[i] - 'A'] = 1;
      } else if (str[i] == '?') {
        numA++;
      }
    }
    int cnt = 0;
    for (int i = 0; i < 10; i++) {
      if (index[i] == 1) cnt++;
    }
    int k = 10;
    while (cnt--) {
      num = num * k;
      k--;
    }
  } else if (str[0] == '?') {
    num = 9;
    for (int i = 1; i < len; i++) {
      if (str[i] >= 'A' && str[i] <= 'J') {
        index[str[i] - 'A'] = 1;
      } else if (str[i] == '?') {
        numA++;
      }
    }
    int cnt = 0;
    for (int i = 0; i < 10; i++) {
      if (index[i] == 1) cnt++;
    }
    int k = 10;
    while (cnt--) {
      num = num * k;
      k--;
    }
  } else if (str[0] >= 'A' && str[0] <= 'J') {
    num = 1;
    for (int i = 0; i < len; i++) {
      if (str[i] >= 'A' && str[i] <= 'J') {
        index[str[i] - 'A'] = 1;
      } else if (str[i] == '?') {
        numA++;
      }
    }
    int cnt = 0;
    for (int i = 0; i < 10; i++) {
      if (index[i] == 1) cnt++;
    }
    num = num * 9;
    cnt--;
    int k = 9;
    while (cnt--) {
      num = num * k;
      k--;
    }
  }
  printf("%d", num);
  for (int i = 0; i < numA; i++) printf("0");
  printf("\n");
  return 0;
}
