#include <bits/stdc++.h>
char a[100100];
int main() {
  while (scanf("%s", a) != EOF) {
    int s[100100] = {0}, times = 10;
    long long int ans;
    if (a[0] >= '1' && a[0] <= '9')
      ans = 1;
    else if (a[0] == '?')
      ans = 9;
    else
      ans = 9, s[a[0] - 'A'] = 1, times--;
    for (int i = 1; a[i]; i++) {
      if (a[i] >= '0' && a[i] <= '9')
        ;
      else if (a[i] == '?')
        ans *= 10;
      else if (s[a[i] - 'A'] == 0)
        ans *= times, s[a[i] - 'A'] = 1, times--;
    }
    printf("%lld\n", ans);
  }
}
