#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int arr[12];
  memset(arr, 0, sizeof(arr));
  int sl, res = 1, ccnt = 0, qcnt = 0;
  cin >> s;
  sl = s.length();
  for (int i = 0; i < sl; i++)
    if (s[i] == 63)
      qcnt++;
    else if (s[i] > 64)
      arr[s[i] - 'A'] = 1;
  for (int i = 0; i < 10; i++)
    if (arr[i]) ccnt++;
  if (s[0] == 63) {
    res = 9;
    qcnt--;
  }
  if (ccnt) {
    if (s[0] > 64)
      res = 9;
    else
      qcnt++;
    ccnt--;
  }
  int tmp = 9;
  for (int i = 0; i < ccnt; i++) {
    res *= tmp;
    tmp--;
  }
  cout << res;
  for (int i = 0; i < qcnt; i++) cout << "0";
  cout << endl;
  return 0;
}
