#include <bits/stdc++.h>
using namespace std;
string s;
long long ans;
bool flag[300];
int main() {
  int i;
  cin >> s;
  int len = s.length();
  long long ans = 1;
  if (s[0] == '?') ans *= 9;
  int mo = 0;
  for (i = 1; i < len; i++) {
    if (s[i] == '?') mo++;
    if ('A' <= s[i] && s[i] <= 'J') flag[s[i]] = true;
  }
  long long zhi;
  if ('A' <= s[0] && s[0] <= 'J') {
    ans *= 9;
    zhi = 1;
  } else
    zhi = 0;
  for (i = 'A'; i <= 'J'; i++)
    if (flag[i])
      if (s[0] == i)
        continue;
      else {
        ans *= (long long)(10 - zhi);
        zhi++;
      }
  cout << ans;
  for (i = 1; i <= mo; i++) cout << 0;
}
