#include <bits/stdc++.h>
using namespace std;
int main() {
  char a, b;
  int h[300] = {0}, c = 10;
  a = getchar();
  while ((b = getchar()) != '\n') {
    if (b == '?') h[b]++;
    if (b >= 'A' && b <= 'J' && !h[b]) h[b] = c--;
  }
  long long int s = 1, q = 0;
  if (a >= 'A' && a <= 'J') {
    h[a] = 9;
    q = 9;
    b = 'A';
    while (b <= 'J') {
      if (h[b] && b != a) h[b] = q--;
      b++;
    }
  }
  b = 'A';
  while (b <= 'J') {
    if (h[b]) s *= h[b];
    b++;
  }
  if (a == '?') s *= 9;
  cout << s;
  if (h['?']) {
    for (int i = 1; i <= h['?']; i++) {
      cout << '0';
    }
  }
  cout << "\n";
  return 0;
}
