#include <bits/stdc++.h>
using namespace std;
char s[50010];
int len, ret;
bool flag[10], f = 0;
long long ans = 1;
int main() {
  scanf("%s", s);
  len = strlen(s);
  memset(flag, 0, sizeof(flag));
  if (s[0] == '?') {
    ans = 9;
    ret = 10;
  } else if (s[0] >= 'A' && s[0] <= 'J') {
    ans = 9;
    ret = 9;
    f = 1;
  } else
    ret = 10;
  for (int i = 1; i < len; ++i) {
    if (s[i] == '?')
      ans *= 10LL;
    else if (s[i] >= 'A' && s[i] <= 'J' && (!f || s[i] != s[0]))
      flag[s[i] - 'A'] = 1;
  }
  for (int i = 0; i < 10; ++i)
    if (flag[i]) ans *= (long long)(ret--);
  cout << ans << endl;
  return 0;
}
