#include <bits/stdc++.h>
using namespace std;
char str[101000];
bool usd[300];
int main() {
  fgets(str, 100999, stdin);
  int i = 0, cnt = 0, ncnt = 0, zcnt = 0, len = strlen(str);
  if (str[len - 1] == '\n') str[len - 1] = 0;
  len = strlen(str);
  for (int i = 0; i < len; ++i) {
    if (str[i] >= '0' && str[i] <= '9')
      continue;
    else if (str[i] == '?')
      ncnt++;
    else if (!usd[str[i]]) {
      cnt++;
      usd[str[i]] = 1;
    }
  }
  long long int ans;
  if (str[0] == '?')
    ans = 9, ncnt--;
  else
    ans = 1;
  for (int i = 1; i <= ncnt; ++i) {
    ans *= 10;
    while (ans % 10 == 0) {
      ans /= 10;
      zcnt++;
    }
  }
  for (int i = 10; i > 10 - cnt; --i) {
    ans *= i;
    while (ans % 10 == 0) {
      ans /= 10;
      zcnt++;
    }
  }
  if (str[0] >= 'A' && str[0] <= 'J') ans *= 9, zcnt--;
  cout << ans;
  for (int i = 1; i <= zcnt; ++i) putchar('0');
  cout << endl;
  return 0;
}
