#include <bits/stdc++.h>
using namespace std;
int fl[300];
int main() {
  string s;
  cin >> s;
  int count = 0;
  memset(fl, 0, sizeof(fl));
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '?') count++;
    if (s[i] >= 'A' && s[i] <= 'J') fl[s[i]] = 1;
  }
  int let = 0;
  for (int i = 0; i < 300; i++) let += fl[i];
  int res = 1;
  for (int i = 0; i < let; i++) res *= (10 - i);
  if (s[0] >= 'A' && s[0] <= 'J') res = res / 10 * 9;
  if (s[0] == '?') {
    res *= 9;
    count--;
  }
  cout << res;
  while (count--) cout << "0";
  cout << endl;
  return 0;
}
