#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  string s;
  cin >> s;
  long long k = 10, ans = 1;
  vector<int> v(12);
  for (long long i = 0; i < s.length(); i++) {
    if (s[i] == '?')
      ans *= (!i ? 9 : 10);
    else if (s[i] - '0' > -1 && s[i] - '0' < 10)
      continue;
    else if (!v[s[i] - 'A']) {
      v[s[i] - 'A']++;
      if (!i) {
        ans *= k - 1;
        k--;
      } else
        ans *= k--;
    }
  }
  cout << ans;
  return 0;
}
