#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<int> cnt(128);
  for (char c : s) cnt[c]++;
  int ans = 1, cur = 10;
  for (char c = 'A'; c <= 'J'; c++)
    if (cnt[c]) {
      if (cur == 10 && isalpha(s[0]))
        ans *= --cur;
      else
        ans *= cur--;
    }
  if (s[0] == '?') ans *= 9, cnt['?']--;
  cout << ans;
  while (cnt['?']--) cout << '0';
  cout << endl;
  return 0;
}
