#include <bits/stdc++.h>
using namespace std;
bool myfunction(int i, int j) { return (i < j); }
int main() {
  std::ios::sync_with_stdio(false);
  std::string password;
  cin >> password;
  vector<bool> letters(10, false);
  int out = 1;
  int count_tens = 0;
  for (unsigned int i = 0; i < password.size(); i++) {
    if (password[i] == '?')
      count_tens++;
    else if (password[i] >= 'A')
      letters[password[i] - 'A'] = true;
  }
  int count = 0;
  for (unsigned int i = 0; i < 10; i++)
    if (letters[i]) count++;
  if (count > 0) {
    count_tens++;
    count--;
  }
  for (unsigned int i = 0; i < count; i++) out *= (10 - i - 1);
  if (password[0] == '?' || password[0] >= 'A') {
    count_tens--;
    out *= 9;
  }
  cout << out;
  if (count_tens > 0)
    for (unsigned int i = 0; i < count_tens; i++) cout << 0;
  return 0;
}
