#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:256000000")
bool b_ar[10] = {false};
long long binpow(long long a, int n) {
  long long res = 1;
  while (n) {
    if (n & 1) res *= a;
    a *= a;
    n >>= 1;
  }
  return res;
}
long long fact(int n) {
  if (n < 2) return 1;
  long long res = 1;
  for (int i = 2; i <= n; ++i) res *= i;
  return res;
}
long long C(int n, int k) {
  if (n <= k || k < 1) return 1;
  return fact(n) / fact(k) / fact(n - k);
}
int main() {
  string s;
  int qs = 0;
  int ls = 0;
  cin >> s;
  for (int i = 0; i < s.length(); ++i)
    if (s[i] == '?')
      ++qs;
    else if (s[i] >= 'A' && s[i] <= 'J')
      b_ar[s[i] - 'A'] = true;
  for (int i = 0; i < 10; ++i) ls += b_ar[i];
  long long ans = C(10, ls) * fact(ls);
  if (s[0] == '?') {
    ans *= 9;
    --qs;
  } else if (s[0] >= 'A' && s[0] <= 'J')
    ans = (C(10, ls) * fact(ls) - C(9, ls - 1) * fact(ls - 1));
  printf("%I64d", ans);
  for (int i = 0; i < qs; ++i) printf("0");
  printf("\n");
  return 0;
}
