#include <bits/stdc++.h>
using namespace std;
long long ans = 1;
string s;
int k, q;
bool a[11];
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] <= '9' && s[i] >= '0') continue;
    if (s[i] == '?')
      q++;
    else
      a[s[i] - 'A'] = true;
  }
  for (int i = 0; i <= 10; i++) k += a[i];
  for (int i = 1; i <= k; i++) {
    ans *= 10 - i + 1;
  }
  if (s[0] <= 'J' && s[0] >= 'A') {
    ans /= 10;
    ans *= 9;
  }
  if (s[0] == '?') ans *= 9, q--;
  cout << ans;
  for (int i = 0; i < q; i++) cout << 0;
  cout << endl;
  return 0;
}
