#include <bits/stdc++.h>
char s[111111];
int v[555];
int x, y, ans;
int main() {
  scanf("%s", s);
  x = y = 0;
  for (int i = 0; s[i]; i++) {
    if (s[i] == '?')
      x++;
    else if (s[i] > '9')
      v[s[i] - 'A']++;
  }
  for (int i = 0; i < 11; i++)
    if (v[i]) y++;
  if (s[0] == '?') {
    ans = 9;
    x--;
    for (int i = 10; i > 10 - y; i--) ans *= i;
  } else if (s[0] > '9') {
    ans = 9;
    y--;
    for (int i = 9; i > 9 - y; i--) ans *= i;
  } else {
    ans = 1;
    for (int i = 10; i > 10 - y; i--) ans *= i;
  }
  printf("%d", ans);
  for (int i = 0; i < x; i++) printf("0");
  printf("\n");
  return 0;
}
