#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m = (long long)(1e9 + 7)) {
  return (n % m + m) % m;
}
inline long long modPow(long long a, long long b,
                        long long m = (long long)(1e9 + 7)) {
  long long ret = 1LL;
  while (b > 0LL) {
    if (b & 1) ret = mod(ret * a, m);
    a = mod(a * a, m);
    b >>= 1;
  }
  return ret;
}
inline bool leapYear(int year) {
  return (year % 400 == 0) || (year % 100 != 0 && year % 4 == 0);
}
char num[100005];
bool done[26];
int main() {
  gets(num);
  int ans = 1;
  int ten = 0;
  int cnt = 10;
  for (int i = 0; num[i]; i++) {
    if (num[i] == '?') {
      if (i == 0)
        ans *= 9;
      else
        ten++;
    } else if (isalpha(num[i]) && !done[num[i]]) {
      if (i == 0)
        ans *= min(cnt, 9);
      else
        ans *= cnt;
      done[num[i]] = true;
      cnt--;
    }
  }
  printf("%d", ans);
  for (int i = (0); i < ((ten)); i++) printf("0");
  printf("\n");
  return 0;
}
