#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INF = 1 << 29;
long long int expo(long long int x, long long int n) {
  long long int ret = 1, sq = x;
  while (n) {
    if (n & 1) {
      ret = ret * sq;
    }
    sq = sq * sq;
    n >>= 1;
  }
  return ret;
}
int main() {
  string s;
  cin >> s;
  int n = s.length();
  map<char, int> mm;
  int q = 0;
  for (int i = 0; i < n; ++i) {
    q += (s[i] == '?');
    if (s[i] >= 'A' and s[i] <= 'Z') ++mm[s[i]];
  }
  long long int ans = 1;
  long long int sz = mm.size();
  if (s[0] == '?')
    ans = 9 * expo(10, q - 1);
  else
    ans = expo(10, q);
  if (s[0] >= 'A' and s[0] <= 'Z') {
    ans *= 9ll;
    --sz;
    long long int val = 9;
    while ((sz--) > 0) {
      ans = ans * val;
      --val;
    }
  } else {
    long long int val = 10;
    while ((sz--) > 0) {
      ans = ans * val;
      --val;
    }
  }
  cout << ans;
  putchar('\n');
  return 0;
}
