#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace std::chrono;
void fastaf(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
bool checkalpha(char c) {
  for (int i = 0; i < 9; i++) {
    int64_t r = c - '0';
    if (r == i) return true;
  }
  return false;
}
bool checklet(char c) {
  int64_t x2 = c - 'a';
  return x2 >= 0 && x2 < 10;
}
void solve(void) {
  string S;
  cin >> S;
  if (S.size() == 1) {
    if (S[0] == '?')
      cout << "9";
    else if (checkalpha(S[0]))
      cout << "1";
    else
      cout << "9";
    return;
  }
  int64_t ans = 1;
  transform(S.begin(), S.end(), S.begin(), ::tolower);
  map<char, int64_t> mp;
  int64_t count = 0, d = 10;
  for (int i = 0; i < S.size(); i++) {
    if (i == 0) {
      if (S[i] == '?')
        ans *= 9;
      else if (checkalpha(S[i]))
        ans *= 1;
      else if (checklet(S[i])) {
        if (mp.find(S[i]) == mp.end()) {
          mp[S[i]]++;
          d--;
          ans *= d;
        }
      }
    } else {
      if (S[i] == '?')
        ans *= 10;
      else if (checkalpha(S[i]))
        ans *= 1;
      else if (checklet(S[i])) {
        if (mp.find(S[i]) == mp.end()) {
          mp[S[i]]++;
          ans *= d;
          d--;
        }
      }
    }
  }
  cout << ans;
}
int main() {
  fastaf();
  solve();
  cout << "\n";
  return 0;
}
