#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  set<char> myset;
  long long ans1 = 0, ans2 = 0;
  for (long long i = 0; i < s.length(); i++) {
    if (s[i] >= 'A' && s[i] <= 'J') {
      myset.insert(s[i]);
    } else if (s[i] == '?') {
      ans2++;
    }
  }
  ans1 = myset.size();
  long long p = ans1, counter = 10;
  long long lans = 1;
  long long rans = 1;
  while (p--) {
    lans = lans * counter;
    counter--;
  }
  if (s[0] >= 'A' && s[0] <= 'J') {
    lans = lans / 10;
    lans = lans * 9;
  }
  p = ans2;
  while (p--) {
    rans = rans * 10;
  }
  if (s[0] == '?') {
    rans = rans / 10;
    rans = rans * 9;
  }
  cout << lans * rans << endl;
}
