#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
const long long maxx = 2e3 + 19;
string s;
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s;
  long long a[100] = {};
  long long ans = 1;
  long long cnt = 0;
  if (s[0] == '?') ans *= 9;
  if (s[0] >= 'A' && s[0] <= 'J') {
    ans *= 9;
    a[s[0] - '0' - 16] = 9;
    cnt++;
  }
  for (long long i = 1; i < s.size(); i++) {
    long long tmp = 0;
    for (long long j = 1; j <= 10; j++)
      if (a[j] > 0) tmp++;
    cnt = tmp;
    if (s[i] == '?') ans *= 10;
    if (s[i] >= 'A' && s[i] <= 'J') {
      if (a[s[i] - '0' - 16] == 0)
        ans *= 10 - cnt, a[s[i] - '0' - 16] = 10 - cnt;
    }
  }
  cout << ans;
  return 0;
}
