#include <bits/stdc++.h>
using namespace std;
long long choice(int n, int r) {
  if (r == 0 || n == r) return 1;
  return choice(n - 1, r - 1) + choice(n - 1, r);
}
int main() {
  string line;
  cin >> line;
  long long result = 1;
  set<char> set;
  for (int i = 0; i < line.size(); i++)
    if (line[i] >= 'A' && line[i] <= 'Z')
      set.insert(line[i]);
    else if (line[i] == '?') {
      if (!i)
        result *= 9;
      else
        result *= 10;
    }
  if (set.size() > 0)
    for (int i = 10; i > 10 - set.size(); i--) result *= i;
  if (set.size() > 0 && line[0] >= 'A' && line[0] <= 'J')
    result /= 10, result *= 9;
  cout << result;
  return 0;
}
