#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
bool vis[N];
vector<int> v[N];
int dfs(int s) {
  vis[s] = 1;
  int sum = 0;
  for (auto i : v[s]) {
    if (vis[i] == 0) sum = sum + dfs(i);
  }
  return sum + 1;
}
void solve() {
  long long n, i, ans = 1;
  bool flag = 0;
  int a[10] = {0}, c = 0, b = 10;
  string s;
  cin >> s;
  n = s.length();
  for (i = 0; i < n; i++) {
    if (s[i] >= '0' && s[i] <= '9') {
      flag = 1;
      continue;
    } else if (s[i] == '?' && flag == 0) {
      flag = 1;
      ans = ans * 9;
    } else if (s[i] == '?')
      c++;
    else if (s[i] >= 'A' && s[i] <= 'J') {
      if (flag == 0) {
        flag = 1;
        a[(int)(s[i] - 'A')] = 1;
        ans = ans * 9;
        b = 9;
      } else {
        if (a[(int)(s[i] - 'A')] == 1) continue;
        a[(int)(s[i] - 'A')] = 1;
        ans = ans * 1ll * b;
        b--;
      }
    }
  }
  cout << ans;
  while (c > 0) {
    cout << "0";
    c--;
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, p;
  t = 1;
  for (p = 1; p <= t; p++) {
    solve();
  }
}
