#include <bits/stdc++.h>
using namespace std;
const int maxN = 100000 + 10;
char str[maxN];
int d[11], dot;
int main() {
  while (scanf("%s", str) == 1) {
    int L = strlen(str);
    memset(d, 0, sizeof(d));
    dot = 0;
    for (int i = 0; i < L; i++) {
      if (str[i] == '?')
        dot++;
      else if (str[i] >= '0' && str[i] <= '9')
        ;
      else
        d[str[i] - 'A'] = 1;
    }
    int sd = 0;
    for (int i = 0; i < 10; i++) sd += d[i];
    if (sd == 0 && dot == 0)
      printf("1\n");
    else {
      if (str[0] >= '0' && str[0] <= '9') {
        int mul = 1, rm = 10;
        while ((sd--) > 0) {
          mul *= rm;
          rm--;
        }
        printf("%d", mul);
        for (int i = 0; i < dot; i++) printf("0");
        printf("\n");
      } else {
        if (str[0] == '?') {
          int mul = 1, rm = 10;
          while ((sd--) > 0) {
            mul *= rm;
            rm--;
          }
          printf("%d", mul * 9);
          for (int i = 0; i < dot - 1; i++) printf("0");
          printf("\n");
        } else {
          int mul = 1, rm = 9;
          sd--;
          while ((sd--) > 0) {
            mul *= rm;
            rm--;
          }
          printf("%d", mul * 9);
          for (int i = 0; i < dot; i++) printf("0");
          printf("\n");
        }
      }
    }
  }
  return 0;
}
