#include <bits/stdc++.h>
using namespace std;
bool vis[25];
string mapa[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
string sum(string a, string b) {
  int L = max(a.size(), b.size());
  string x = string(L, ' ');
  int lleva = 0;
  for (int i = 0; i < L; i++) {
    int c = lleva;
    if ((int)a.size() - i - 1 >= 0) c += a[a.size() - i - 1] - '0';
    if ((int)b.size() - i - 1 >= 0) c += b[b.size() - i - 1] - '0';
    lleva = c / 10;
    x[x.size() - i - 1] = (char)(c % 10 + '0');
  }
  if (lleva) x = (char)(lleva + '0') + x;
  return x;
}
string prod(string a, string b) {
  if (a == "0" || b == "0")
    return "0";
  else if (a.size() == 1) {
    int m = a[0] - '0';
    string ans = string(b.size(), '0');
    int lleva = 0;
    for (int i = b.size() - 1; i >= 0; i--) {
      int d = (b[i] - '0') * m + lleva;
      lleva = d / 10;
      ans[i] += d % 10;
    }
    if (lleva) ans = (char)(lleva + '0') + ans;
    return ans;
  } else if (b.size() == 1)
    return prod(b, a);
  else {
    string ans = "0";
    string ceros = "";
    for (int i = a.size() - 1; i >= 0; i--) {
      string s = prod(string(1, a[i]), b) + ceros;
      ceros += "0";
      ans = sum(ans, s);
    }
    return ans;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  string res = "1";
  int ct = 0, tam = s.length();
  for (int i = 0; i < tam; ++i) {
    if (i == 0) {
      if (s[i] == '?') res = prod(res, "9");
      if (s[i] >= 'A' && s[i] <= 'J') {
        ct++;
        res = prod(res, "9");
        vis[s[i] - 'A'] = 1;
      }
    } else {
      if (s[i] == '?') res += "0";
      if (s[i] >= 'A' && s[i] <= 'J' && vis[s[i] - 'A'] == 0) {
        int val = 10 - ct;
        res = prod(res, mapa[val]);
        ct++;
        vis[s[i] - 'A'] = 1;
      }
    }
  }
  cout << res << endl;
}
