#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int M = 100005;
const int mod = 7340033;
const double eps = 1e-6;
const double Pi = 2 * acos(0.0);
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a < b ? a : b; }
inline int bit(int x) { return 1 << x; }
inline double dabs(double x) { return x > 0 ? x : (-x); }
inline int iabs(int x) { return x > 0 ? x : (-x); }
inline int lowbit(int x) { return x & (-x); }
template <class T>
inline void checkmin(T &a, T b) {
  if (a == -1 || b < a) a = b;
}
char s[M];
bool use[10];
int main() {
  ios::sync_with_stdio(0);
  cin >> s;
  int cnt = 0, tot = 0;
  for (int i = 0; s[i]; i++) {
    if (s[i] >= 'A' && s[i] <= 'J') {
      use[s[i] - 'A'] = 1;
    } else if (s[i] == '?') {
      tot++;
    }
  }
  for (int i = 0; i < 10; i++) {
    cnt += use[i];
  }
  long long ans = 1;
  if (s[0] >= '1' && s[0] <= '9') {
    int t = 10;
    while (cnt) {
      ans *= t;
      t--;
      cnt--;
    }
    for (int i = 0; i < tot; i++) {
      ans *= 10;
    }
  } else if (s[0] == '?') {
    int t = 10;
    while (cnt) {
      ans *= t;
      t--;
      cnt--;
    }
    ans *= 9;
    for (int i = 1; i < tot; i++) {
      ans *= 10;
    }
  } else {
    int t = 9;
    ans = 9;
    cnt--;
    while (cnt) {
      ans *= t;
      t--;
      cnt--;
    }
    for (int i = 0; i < tot; i++) {
      ans *= 10;
    }
  }
  cout << ans << endl;
  return 0;
}
