#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
char t[MAX];
bool wart[500];
int hm[11];
int numb[100005];
int main() {
  gets(t);
  string s = t;
  long long wyn = 1;
  long long mn = 10;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] <= '9' && s[i] >= '0') continue;
    if (s[i] == '?') {
      if (i == 0)
        wyn *= 9LL;
      else
        hm[10]++;
      continue;
    }
    if (wart[s[i]] == 1) continue;
    if (i == 0)
      wyn *= 9LL;
    else
      wyn *= mn;
    mn--;
    wart[s[i]] = 1;
  }
  printf("%I64d", wyn);
  for (int i = 0; i < hm[10]; ++i) printf("0");
}
