#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool b[10];
  for (int i = 0; i < 10; i++) b[i] = false;
  int l = s.length(), wht = 0, ww = 10;
  long long res = 1;
  for (int i = 0; i < l; i++) {
    if (s[i] == '?')
      wht++;
    else if (s[i] >= 'A' && s[i] <= 'J')
      b[s[i] - 'A'] = true;
  }
  for (int i = 0; i < 10; i++)
    if (b[i]) res *= (ww--);
  if (s[0] >= 'A' && s[0] <= 'J') res = (res / 10) * 9;
  if (s[0] == '?') {
    if (res == 1) {
      res = 9;
      wht--;
    } else {
      res = (res / 10) * 9;
    }
  }
  cout << res;
  for (int i = 0; i < wht; i++) cout << "0";
  cout << "\n";
  return 0;
}
