#include <bits/stdc++.h>
int n, m, t = 10, ans = 1, cnt = 0;
using namespace std;
int main() {
  string st;
  set<char> s;
  cin >> st;
  n = st.size();
  for (int i = 0; i < n; i++)
    if (isalpha(st[i])) s.insert(st[i]);
  m = s.size();
  if (isalpha(st[0])) {
    ans *= (t - 1);
    t--;
    m--;
  } else if (st[0] == '?')
    ans *= 9;
  for (int i = 0; i < m; i++) ans *= (t - i);
  for (int i = 1; i < n; i++)
    if (st[i] == '?') cnt++;
  cout << ans;
  while (cnt--) putchar('0');
  cout << endl;
}
