#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int x = 10;
  cin >> s;
  long long prod = 1;
  for (int i = 0; i < (int)s.length(); i++) {
    if (s[i] == '?') {
      if (i == 0)
        prod *= 9;
      else
        prod *= 10;
    }
    if (isalpha(s[i])) {
      for (int j = i + 1; j < (int)s.length(); j++) {
        if (s[j] == s[i]) s[j] = '0';
      }
      if (i == 0) {
        x--;
        prod *= 9;
      } else {
        prod *= x;
        x--;
      }
      s[i] = '0';
    }
  }
  cout << prod << endl;
  return 0;
}
