#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0, count1 = 0;
  vector<bool> v(10, false);
  string s;
  long long int n = 1;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?')
      count++;
    else if (s[i] >= 'A' && s[i] <= 'J')
      v[s[i] - 'A'] = true;
  }
  for (int i = 0; i < 10; i++)
    if (v[i] == true) count1++;
  if (count1 > 0) {
    if ((s[0] >= '0' && s[0] <= '9') || s[0] == '?') {
      for (int j = 10; j > 10 - count1; j--) n *= j;
    } else {
      n = 9;
      for (int j = 9; j > 10 - count1; j--) n *= j;
    }
  }
  if (s[0] != '?') {
    for (int i = 0; i < count; i++) n *= 10;
  } else if (s[0] == '?') {
    n *= 9;
    for (int i = 0; i < count - 1; i++) n *= 10;
  }
  cout << n << endl;
  return 0;
}
