#include <bits/stdc++.h>
using namespace std;
int rem = 10;
set<char> st;
int main() {
  string s;
  cin >> s;
  long long ans = 1;
  int zeroes = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= '0' && s[i] <= '9') continue;
    if (s[i] == '?') {
      if (i == 0)
        ans *= 9;
      else
        zeroes += 1;
    } else {
      if (st.count(s[i])) continue;
      st.insert(s[i]);
      if (i == 0)
        ans *= 9;
      else
        ans *= rem;
      rem--;
    }
  }
  cout << ans;
  while (zeroes) {
    cout << "0";
    zeroes--;
  }
  return 0;
}
