#include <bits/stdc++.h>
long long ans;
bool f, b[100];
char s[10100];
int i, dist, k;
int main() {
  scanf("%s", &s);
  f = false;
  memset(b, 0, sizeof(b));
  if ('1' <= s[0] && s[0] <= '9')
    ans = 1;
  else if (s[0] == '?')
    ans = 9;
  else {
    ans = 1;
    f = true;
    b[s[0] - 'A'] = 1;
  }
  for (i = 1; s[i]; i++) {
    if (s[i] == '?')
      k++;
    else if ('A' <= s[i] && s[i] <= 'J')
      b[s[i] - 'A'] = 1;
  }
  dist = 0;
  for (i = 0; i < 10; i++)
    if (b[i]) dist++;
  for (; dist; dist--) ans *= (11 - dist);
  if (f) ans = ans / 10 * 9;
  printf("%I64d", ans);
  for (; k; k--) printf("0");
  return 0;
}
