#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int c = 0, null = 0;
  long long ans = 1;
  bool used['J' + 1] = {0};
  for (int i = 0; i < s.length(); i++) {
    if (s[i] >= 'A' && s[i] <= 'J') {
      if (!used[s[i]]) c++;
      used[s[i]] = 1;
    }
  }
  for (int i = 10; i > 10 - c; i--) {
    ans *= i;
  }
  if (c > 0 && s[0] >= 'A' && s[0] <= 'J') ans = ans / 10 * 9;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '?') null++;
  }
  if (s[0] == '?') ans *= 9;
  cout << ans;
  for (int i = 0; i < null; i++) cout << '0';
}
