#include <bits/stdc++.h>
using namespace std;
char s[100005];
int rec[30];
int main() {
  int k, f, i, id, qt;
  gets(s);
  k = strlen(s);
  f = 0;
  id = s[0] - 'A';
  if (0 <= id && id < 10) f = 1;
  if (s[0] == '?') f = 2;
  qt = 0;
  memset(rec, 0, sizeof(rec));
  for (i = 0; i < k; i++) {
    id = s[i] - 'A';
    if (s[i] == '?') qt++;
    if (0 <= id && id < 10) rec[id] = 1;
  }
  int n1, tins, st;
  long long ans;
  ans = 1;
  n1 = -1;
  for (i = 0; i < 10; i++) n1 += rec[i];
  if (f != 0) ans *= 9;
  if (f == 2) qt--;
  tins = qt;
  if (f != 1 && n1 >= 0) tins++;
  st = 9;
  for (i = 0; i < n1; i++) {
    ans *= st;
    st--;
  }
  cout << ans;
  for (i = 0; i < tins; i++) printf("0");
  printf("\n");
  return 0;
}
