#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long int ans = 1;
  long long int ten = 0;
  set<long long int> used;
  set<long long int> rem;
  for (long long int i = 0; i < ((long long int)(((long long int)(s).size())));
       ++i)
    if ('A' <= s[i] && s[i] <= 'J' && used.count(s[i]) == 0) {
      long long int t = 10 - ((long long int)(used).size());
      if (i == 0) t--;
      ans *= t;
      used.insert(s[i]);
    }
  if (s[0] == '?') ans *= 9;
  cout << ans;
  for (long long int i = 0; i < ((long long int)(((long long int)(s).size())));
       ++i)
    if (i && s[i] == '?') cout << "0";
  cout << endl;
}
