#include <bits/stdc++.h>
using namespace std;
int letters[10];
int main() {
  string s;
  cin >> s;
  long long ans = 1;
  int m = 10;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] >= 65 && s[i] <= 74) {
      letters[s[i] - 65]++;
      if (letters[s[i] - 65] == 1 && i != 0) {
        ans *= m;
        m--;
      } else if (letters[s[i] - 65] == 1 && i == 0) {
        ans *= (m - 1);
        m--;
      }
    } else if (s[i] == '?' && i != 0)
      ans *= 10;
    else if (s[i] == '?' && i == 0)
      ans *= 9;
  }
  cout << ans << endl;
}
