#include <bits/stdc++.h>
using namespace std;
int c[50], len, nl, n10;
char s[100005];
long long cnt = 1;
int main() {
  int i, t;
  scanf("%s", s);
  len = strlen(s);
  for (i = 0; i < len; ++i) {
    if (s[i] == '?') {
      t = (i ? 10 : 9);
      if (t == 10)
        n10++;
      else
        cnt *= t;
    } else if (s[i] >= 'A' && s[i] <= 'J') {
      if (!c[s[i] - 'A']) {
        nl++;
        c[s[i] - 'A']++;
        t = 11 - nl;
      } else
        t = 1;
      t = (i ? t : t - 1);
      if (t == 10)
        n10++;
      else
        cnt *= t;
    }
  }
  printf("%I64d", cnt);
  for (i = 0; i < n10; ++i) printf("0");
  return 0;
}
