#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int outn = 1;
  int bign = 10;
  bool ch[10] = {false};
  for (int i = 0; i < str.length(); i++) {
    char c = str[i];
    if (c <= '9' && c >= '0')
      continue;
    else if (i == 0 && c == '?')
      outn *= 9;
    else if (i == 0 && c >= 'A' && c <= 'J') {
      outn *= 9;
      ch[c - 'A'] = true;
      bign--;
    } else if (c == '?')
      outn *= 10;
    else if (c <= 'J' && c >= 'A' && ch[c - 'A'] == true) {
      continue;
    } else if (c <= 'J' && c >= 'A' && ch[c - 'A'] == false) {
      outn *= bign;
      bign--;
      ch[c - 'A'] = true;
    }
  }
  cout << outn << endl;
}
