#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  long long x = 1;
  long long zero = 0;
  set<char> q;
  bool h = 0, mn = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '?') {
      if (h)
        zero++;
      else {
        x = x * 9;
        h = 1;
      }
    } else if (s[i] >= '0' && s[i] <= '9') {
      if (s[i] > '0') h = 1;
    } else {
      if (h)
        q.insert(s[i]);
      else {
        q.insert(s[i]);
        mn = 1;
        h = 1;
      }
    }
  }
  for (long long t = 10; t > 10 - q.size(); t--) {
    if (mn == 1 && t == 10)
      x = x * 9;
    else
      x = x * t;
  }
  cout << x;
  for (int i = 0; i < zero; i++) cout << 0;
  cout << endl;
  return 0;
}
