#include <bits/stdc++.h>
using namespace std;
int main() {
  set<char> c;
  int mul = 0;
  long long ans = 1;
  bool f = false;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '?')
      ans *= 10;
    else if (s[i] >= 65 && s[i] <= 74)
      c.insert(s[i]);
  }
  if (s[0] >= 65 && s[0] <= 74 || s[0] == '?') f = true;
  for (int i = 0; i < c.size(); i++) ans *= (10 - i);
  if (f == true) ans *= 0.9;
  cout << ans;
  return 0;
}
