#include <bits/stdc++.h>
int ans1, ans2, dat[10], cnt;
char ch;
int main() {
  ans1 = 1;
  ans2 = 0;
  scanf("%c", &ch);
  cnt = 10;
  switch (ch) {
    case '?':
      ans1 *= 9;
      break;
    default:
      if (ch <= '9') break;
      dat[ch - 'A'] = 1;
      ans1 *= 9;
      cnt--;
  }
  while (scanf("%c", &ch) != EOF) {
    switch (ch) {
      case '?':
        ans2++;
        break;
      default:
        if (ch <= '9') break;
        if (dat[ch - 'A']) break;
        dat[ch - 'A'] = 1;
        ans1 *= cnt--;
    }
  }
  printf("%d", ans1);
  for (int i = 1; i <= ans2; i++) printf("0");
  printf("\n");
  return 0;
}
