#include <bits/stdc++.h>
using namespace std;
const int MOD = 3046201;
string s;
bool use[150];
int main() {
  while (getline(cin, s)) {
    long long ans = 1;
    int cnt = 0;
    int len = s.size() - 1;
    memset(use, false, sizeof(use));
    int c = 10;
    if (s[0] == '?')
      ans = 9;
    else if (s[0] >= 'A' && s[0] <= 'J') {
      ans = 9;
      use[(int)s[0]] = true;
      c--;
    }
    for (int i = 1; i <= len; i++) {
      if (s[i] >= '0' && s[i] <= '9') continue;
      if (s[i] == '?')
        cnt++;
      else {
        if (use[(int)s[i]] == false) {
          ans *= c;
          c--;
          use[(int)s[i]] = true;
        }
      }
    }
    cout << ans;
    for (int i = 0; i < cnt; i++) cout << 0;
    cout << endl;
  }
  return 0;
}
