#include <bits/stdc++.h>
using namespace std;
string s;
bool f[20];
int main() {
  ios::sync_with_stdio(0);
  cin >> s;
  long long n = s.length();
  s = " " + s;
  long long res = 1;
  for (long long i = (1), _b = (n); i <= _b; i++)
    if (s[i] >= 'A' && s[i] <= 'J') f[s[i] - 'A'] = true;
  long long k = 0;
  for (long long i = (0), _b = (9); i <= _b; i++)
    if (f[i]) k++;
  for (long long i = (0), _b = (k - 1); i <= _b; i++) res *= (10 - i);
  if (s[1] >= 'A' && s[1] <= 'J') res = res / 10 * 9;
  if (s[1] == '?') res *= 9;
  cout << res;
  for (long long i = (2), _b = (n); i <= _b; i++)
    if (s[i] == '?') cout << 0;
  return 0;
}
