#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 14;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  string s;
  cin >> s;
  int cnt = 0;
  int ans = 1;
  int qMarks = count(s.begin(), s.end(), '?');
  for (char l = 'A'; l <= 'J'; l++) cnt += count(s.begin(), s.end(), l) > 0;
  if (s[0] >= 'A' && s[0] <= 'J')
    for (int i = 0; i < cnt; i++) ans *= min(9, 10 - i);
  else
    for (int i = 0; i < cnt; i++) ans *= 10 - i;
  if (s[0] == '?') ans *= 9, qMarks--;
  cout << ans << string(qMarks, '0') << '\n';
}
