/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                             //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

inline ll max(ll a, ll b)
{
  if(a>b) re a;
  else re b;
}

inline ll min(ll a, ll b)
{
  if(a>b) re b;
  else re a;
}

int gcd(int a, int b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(NULL);

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    // cin>>n;
    string s;
    set<char> v;
    cin>>s;
    // cout<<"YES";
    forup(i,s.L())
    {
      if(s[i]>='A' && s[i]<='J')
      v.insert(s[i]);
    }
    ll ans=1;

    // cout<<"YES";

    forup(i,v.size())
    {
      ans*=10-i;
    }
    if(s[0]<='J' && s[0]>='A')
    {
      ans*=9;
      ans/=10;
    }
    forup(i,s.L())
    {
      if(s[i]=='?')
      {
        if(i==0) ans*=9;
        else ans*=10;
      }
    }

    cout<<ans<<el;
  }

  return 0;
}


/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                             //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

inline ll max(ll a, ll b)
{
  if(a>b) re a;
  else re b;
}

inline ll min(ll a, ll b)
{
  if(a>b) re b;
  else re a;
}

int gcd(int a, int b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(NULL);

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    // cin>>n;
    string s;
    set<char> v;
    cin>>s;
    forup(i,s.L())
    {
      if(s[i]>='A' && s[i]<='J')
      v.insert(s[i]);
    }
    ll ans=1;
    forup(i,v.size()-1)
    {
      ans*=9-i;
    }
    if(s[0]<='J' && s[0]>='A')
    {
      ans*=9;
    }
    else ans*=10;
    forup(i,s.L())
    {
      if(s[i]=='?')
      {
        if(i==0) ans*=9;
        else ans*=10;
      }
    }

    cout<<ans<<el;
  }

  return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod 10007
#define v1d vector<int>
#define v2d vector<vector<int> >
#define endl "\n"

int fun(int m, bool flag){
    if(flag){
        int ans=1;
        for(int i=9; i>10-m; i--){
            ans*=i;
        }
        return ans*9;
    }
    int ans=1;
    for(int i=10; i>10-m; i--){
        ans*=i;
    }
    return ans;
}

int32_t main(){
    IOS;
    int n,c,q=0;
    string s;
    cin>>s;
    n=s.length();
    set<char> myset;
    for(int i=0; i<n; i++){
        if(s[i]=='?')
            q++;
        else if(s[i]>='A'&&s[i]<='J'){
            c++;
            myset.insert(s[i]);

        }
    }//cout<<q<<" "<<myset.size()<<endl;
    int ans=1;
    if(s[0]=='?'){
        ans=9;
        q--;
    }
    if(s[0]>='A'&&s[0]<='J'){
        ans*= fun(myset.size(),true);//cout<<" "<<ans<<endl;
    }
    else{
        ans*= fun(myset.size(),false);//cout<<" "<<ans<<endl;
    }
    cout<<ans;
    while(q--){
        cout<<"0";
    }

	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod 10007
#define v1d vector<int>
#define v2d vector<vector<int> >
#define endl "\n"

int fun(int m, bool flag){
    if(flag){
        int ans=1;
        for(int i=9; i>10-m; i--){
            ans*=i;
        }
        return ans*9;
    }
    int ans=1;
    for(int i=10; i>10-m; i--){
        ans*=i;
    }
    return ans;
}

int32_t main(){
    IOS;
    int n,c,q=0;
    string s;
    cin>>s;
    n=s.length();
    set<char> myset;
    for(int i=0; i<n; i++){
        if(s[i]=='?')
            q++;
        else if(s[i]>='A'&&s[i]<='J'){
            c++;
            myset.insert(s[i]);

        }
    }//cout<<q<<" "<<myset.size()<<endl;
    int ans=1;
    if(s[0]=='?'){
        ans=9;
        q--;
    }
    if(s[0]>='A'&&s[0]<='J'){
        ans*= fun(myset.size(),true);//cout<<" "<<ans<<endl;
    }
    else{
        ans*= fun(myset.size(),false);//cout<<" "<<ans<<endl;
    }
    cout<<ans*pow(10,q);

	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod 10007
#define v1d vector<int>
#define v2d vector<vector<int> >
#define endl "\n"

int fun(int m, bool flag){
    if(flag){
        int ans=1;
        for(int i=9; i>10-m; i--){
            ans*=i;
        }
        return ans*9;
    }
    int ans=1;
    for(int i=10; i>10-m; i--){
        ans*=i;
    }
    return ans;
}

int32_t main(){
    IOS;
    int n,c,q=0;
    string s;
    cin>>s;
    n=s.length();
    set<char> myset;
    for(int i=0; i<n; i++){
        if(s[i]=='?')
            q++;
        else if(s[i]>='A'&&s[i]<='J'){
            c++;
            myset.insert(s[i]);

        }
    }//cout<<q<<" "<<myset.size()<<endl;
    int ans=1;
    if(s[0]=='?'){
        ans=9;
        q--;
    }
    else if(s[0]>='A'&&s[0]<='J'){
        ans*= fun(myset.size(),true);//cout<<myset.size()<<" "<<ans<<endl;
    }
    else{
        ans*= fun(myset.size(),false);//cout<<myset.size()<<" "<<ans<<endl;
    }
    cout<<ans*pow(10,q);

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
int months[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int M = (int)1e5 + 10;
string str;

bool solve()
{
    ll temp, ans = 0;
    int cnt = 0;
    map<char, int> mp;
    for(int i = 0; i < sz(str); i++) mp[str[i]]++;
    if(mp['?'])
    {
        if(str[0] == '?') temp = 9;
        else temp = 10;
        for(int i = 0; i < mp['?'] - 1; i++) temp *= 10;
        ans += temp;
    }
    if(!ans) ans = 1;
    //cout << ans << endl;
    temp = 0;
    for(auto it : mp)
    {
        if(it.first >= 'A' && it.first <= 'Z') cnt++;
    }
    if(str[0] >= 'A' && str[0] <= 'Z') temp = 9;
    else temp = 10;
    if(!cnt) temp = 1;
    for(int i = 0, j = 9; i < cnt - 1; i++, j--) temp *= j;
    ans *= temp;
    cout << ans;
    return 0;
}

int main()
{
    cin >> str;
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
int months[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int M = (int)1e5 + 10;
string str;

bool solve()
{
    ll temp, ans = 0;
    int cnt = 0, z = 0;
    map<char, int> mp;
    for(int i = 0; i < sz(str); i++) mp[str[i]]++;
    if(mp['?'])
    {
        if(str[0] == '?') temp = 9;
        else temp = 10;
        for(int i = 0; i < mp['?'] - 1; i++) z++;
        ans += temp;
    }
    if(!ans) ans = 1;
    //cout << ans << endl;
    temp = 0;
    for(auto it : mp)
    {
        if(it.first >= 'A' && it.first <= 'Z') cnt++;
    }
    if(str[0] >= 'A' && str[0] <= 'Z') temp = 9;
    else temp = 10;
    if(!cnt) temp = 1;
    for(int i = 0, j = 9; i < cnt - 1; i++, j--) temp *= j;
    ans *= temp;
    cout << ans;
    while(z--) cout << "0";
    return 0;
}

int main()
{
    cin >> str;
    solve();
    return 0;
}


/**********************************************************
 *     Code written by Akikaze                            *
 *     Duy-Bach Le, #Team4T's Chief Executor              *
 *     #Team4T Tertiary Flagship - Oblivion               *
 *                                                        *
 *     Written by a random fan of momocashew and Chiho    *
 *                                                        *
 *     Arigatougozaimasu, imouto-chan.                    *
 **********************************************************/

/************** [OPTIMIZATION PROTOCOL] **************/
#pragma comment(linker, "/stack:225450978")
#pragma GCC optimize("Ofast")
/*****************************************************/

/************** [LIBRARY PROTOCOL] **************/
#include <bits/stdc++.h>
using namespace std;
/************************************************/

/************** [LEGENDS/CONSTANTS] **************/
#define endl '\n'
#define i64 long long
#define ld long double
#define rsz resize
#define pub push_back
#define mp make_pair
#define fi first
#define se second
typedef vector<i64> vi;
typedef vector<ld> vd;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef pair<i64, i64> pii;
typedef pair<i64, pii> pip;
typedef pair<pii, i64> ppi;
const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double Pi = 3.141592653589793116, EPS = 1e-9, Gold = ((1+sqrt(5))/2);
long long keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 1000000033LL};
long long keyCount = sizeof(keymod) / sizeof(long long);
/*************************************************/

/************** [BITWISE FUNCTIONS] **************/
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcountll(s); }
/*************************************************/

/************** [MASTER CONTROLS - PHASE 1] **************/
auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();
#define OImode 227420978
#define MultiTest 227420978
#define Interactive 227420978

#undef OImode // Switch this off if submitting OI problems.
#undef MultiTest // Switch this off if submitting multi-test problems.
#undef Interactive // Switch this off if submitting interactive problems. Also required when you need to debug step-by-step.

void ControlIO(int argc, char* argv[]);
void TimerStart();
void TimerStop();
void Exit();
string cppstr_infile = "FILE.IN";
string cppstr_outfile = "FILE.OUT";
/*********************************************************/

/************** [GLOBAL VARIABLES] **************/
string s; map<char, i64> Map; i64 q = 0;
/************************************************/

/************** [FUNCTIONS] **************/

void Input() {
	cin >> s;
}

void Solve() {
	i64 baseAnswer = 1;
	for (auto x: s) {
		if (x >= '0' && x <= '9') continue;
		if (x == '?') {q++; continue;} Map[x]++;
	}
	for (i64 i=10; i>10-Map.size(); i--) baseAnswer *= i;
	if (s[0] >= 'A' && s[0] <= 'J') {baseAnswer /= 10; baseAnswer *= 9;}
	if (s[0] == '?') {baseAnswer *= 9; q--;}
	cout << baseAnswer; for (i64 i=0; i<q; i++) cout << "0";
}
/*****************************************/

/************** [MAIN] **************/
int main(int argc, char* argv[]) {
	ControlIO(argc, argv);

	#ifndef Interactive
		ios_base::sync_with_stdio(0); cin.tie(NULL);
	#else
		ios_base::sync_with_stdio(0);
	#endif

	#ifndef MultiTest
		Input(); TimerStart();
		Solve(); TimerStop();
	#else
		int T; cin >> T; TimerStart();
		while(T--) {Input(); Solve();}
		TimerStop();
	#endif

	return 0;
}
/************************************/

/************** [MASTER CONTROLS - PHASE 2] **************/
void ControlIO(int argc, char* argv[]) {
	char* infile = new char[cppstr_infile.size()+1];
	char* outfile = new char[cppstr_outfile.size()+1];
	strcpy(infile, cppstr_infile.c_str());
	strcpy(outfile, cppstr_outfile.c_str());
	#ifdef Akikaze
		time_t t = time(0);
		tm* now = localtime(&t);
		cout << "Source code by #Team4T-Akikaze.\n";
		cout << "Current time: ";
		cout << (now->tm_year + 1900) << '-'
			 << ((now->tm_mon < 9) ? "0" : "") << (now->tm_mon + 1) << '-'
			 << ((now->tm_mday < 10) ? "0" : "") <<  now->tm_mday << " | "
			 << ((now->tm_hour < 10) ? "0" : "") <<  now->tm_hour << ":"
			 << ((now->tm_min < 10) ? "0" : "") <<  now->tm_min << ":"
			 << ((now->tm_sec < 10) ? "0" : "") <<  now->tm_sec
			 << "\n\n";

		#ifdef OImode
			cout << "OI-Mode: ON\n";
			cout << "Input file: " << infile << endl;
			cout << "Output file: " << outfile << endl;
			cout << "\n";
		#else
			cout << "OI-Mode: OFF\n";
			cout << "Input file: NULL\n";
			cout << "Output file: NULL\n";
			cout << "\n";
		#endif

		#ifdef MultiTest
			cout << "MultiTest-Mode: ON\n";
		#else
			cout << "MultiTest-Mode: OFF\n";
		#endif

		#ifdef Interactive
			cout << "Interactive-Mode: ON\n\n";
		#else
			cout << "Interactive-Mode: OFF\n\n";
		#endif

		if (argc > 1) assert(freopen(argv[1], "r", stdin));
		if (argc > 2) assert(freopen(argv[2], "w", stdout));
	#elif OImode
		freopen(infile, "r", stdin);
		freopen(outfile, "w", stdout);
	#endif
}

void TimerStart() {
	#ifdef Akikaze
		TimeStart = chrono::steady_clock::now();
	#endif
}

void TimerStop() {
	#ifdef Akikaze
		TimeEnd = chrono::steady_clock::now();
		auto ElapsedTime = TimeEnd - TimeStart;
		cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n";
	#endif
}

void Exit() {
	TimerStop(); exit(0);
}
/*********************************************************/

/*********************************************************************************************************************************************************************************************************
 * ti;.                               .:,:i:         :,;;itt;.        fDDEDDEEEEEEKEEEEEKEEEEEEEEEEEEEEEEE###WKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWW#WWWWWKKKKKEE      :,:.    f::::. .,ijLGDDDDDDDEEEEEEE*
 *ti;.                               .:,:i:          .:,;itt;:      GLDEEGEEEEEEEEEEEEEEEEEEDEEEEEEEEEEE#W#WEKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKKKKKKG.     .::.      f:,...,ijLGDDDDDDDDEEEEEE *
 *ti;.                               .:,:i:            :,;;iti,    :fDDEEEEEEEEEEEEEEEKEEEEDEEEEEEEEEEEW##WEEEKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWWKKKKKKEG     .::.       .f,::,ijLGDDDDDDDDEEEEEE *
 *ti;.                               .:,:i:             .,,;iti;.  LDDEEEEEEEEEEKEEEEWEEEDDEEEEEEEEEEE#WWWEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWKKKKKEDj    .::.        .:L;;ijfGDDDDDDDDDEEEEE *
 *ti;.                               .:,:i:              .:,;;iii:LLDEEEEEEEEEEEKEEEEEEEEDEEEEEEEEEEEW#WWEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWKWWWWWWWWWWWWWWKKKKKKKEL    .::.         .:;LijLGGDDDDDDDDEEEEE *
 *ti;.                               .:,:;:                :,;;ittfDEEEEEEEEEEEEEEEEKEEEGEEEEEEEEEEEKWWWEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWKKKKKKKELj   .::.          :,;jffGGDDDDDDDDDEEEE *
 *ti;.                               .:,:i:                 .,;;tGGDEEEEEEEEEEEKEEEKEEEDEEEEEEEEEEEEWWWEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWKWWWWWWKKKKKKKEEL   .::.          .:;itDGGDDDDDDDDDEEEE *
 *ti;.                               .:::;:                   :;ifDEEEEEEEEEEEEKEEEKEEEEEEEEEEEEEEEWWWEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WWWKKKKKKKKEEf   .::.           :,itfGEDDDDDDDDDDDEE *
 *ti;.                               .:::;:                    :GGEEEEEEEEEEEKEKEEKEEEEEEEEEEEEEEEEWWEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKKEEDG  .::.           .,;jfLGKDLDDDDDDEEDD *
 *ti;.                               .:::;:                     fDEEEEEEKKKKKKKKKEKEEEEEEEEEEEEEEE#WEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#KKKKKKKKKKEEf .:::.           .,;tfLGDEDDDDDDDDEEE *
 *ti;.                                :::;:                    fDEEEEEEKKKKKKKKKKWKEEEEEEEEEEEEEEEWKEEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKKKEEft :::.           .,;tfLGDDDKDDDDDDDDD *
 *ti;.                                .::;:                    fDEEEEEEKKKKKKKWKKKKKEEEEEEEEEEEEE#WEEWEEEEEDEEDEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKEEGG :,:.           .,;tfLGGDDDKDDDDDDDD *
 *ti;.                                .:.;:                   tGDEEEEKKKKKKKKKKKKKKKKKEEEEEEEEEEEWEEKWEEEEEEEDEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKKKKKEEDf :::.           .,;tfLGGDDDDEDDDDDDD *
 *ti;.                                .::;:                   fDEEEEEKKKKKKKKKKKWKKKKKKKKEEEEEEEWWEEWEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKEEEft.::.           .,;tfLGGDDDDDDEDDDDD *
 *ti;.                                .:.;:                  tGDEEEKKKKKKKKKKKKKKKKKKKKKKEKEEEEE#EEWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKEEEGD:::.           .,;tfLGGDDDDDDDEDDDD *
 *ti;.                                .:.,.                  LDEEEEKKKKKKKKKKWKWKKKKKKKKKKKKEEEKWEKW#EEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKW##KKKKKKEEEEf,,:.           .,;tfLGGDDDDDDDDEDDD *
 *ti;.                               ..:.,.                 LGDEEEEKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEEW#WEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKK##KKKKKEEEEEfi;,.           .,;tfLGGDDDDDDDDDKDD *
 *tt;.                                .:.,:                 jDEEEEKKKKKKKKKKWWKKKKKKKKKKKKKKKKKWKE#WWEEEEEEEEEEEEEEWEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKWWKKKKEEEEDfG;,:           .,;tfLGGDDDDDDDDDDKD *
 *tii,.                               .:.,.                tGDEEEEKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKKWWWKEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKW#KKKKEEEEDGGi;,.          .,;tfLGGDDDDDDDDDDDE *
 *ti;;,:.                             .:.,:                fDEEEEKKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEK#WWKEEEEEEEEEEEEDEEEEEEEEEEEEEEGEEEEEEEEEEEEEEEEEEEKKKKKKKWWKKEEEEEEDDf;;;,.         .,;tfLGGDDDDDDDDDDDD *
 *tii;,,:..                           ...,.               ;LEEEEEKKKKKKWKKKKWKKKKKKKKKKKKKKKKKEKKW#WEEEEEEEEEEEEEjEEEEEEEEEKEEEEGEEEEEEEEEKEEEEEEEEEEEEEEEEE#WKEEEEEEDDf;;;;,:        .,itfLGGDDDDDDDDDDDD *
 *ti;,,,,,:.                          ...,.               LDEEEEKKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKK#W#WEEEEEEEEEEEDDLEEEEEEEEEWEEEEDEEEEEEEEEKEEEEEEEEEEEEEEEEEWWEEEEEEEDDfj,,,,,:.      .,itfGGGDDDDDDDDDDDD *
 *tii,,,,::::.                        ...,:              .fDEEEEKKKKKKWKKKKWWWKKKKKKKKKKKKKKKEKKW#WWEEEEEEEEEEEKiKEEKEEEEEEWEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEEWWEEEEEEEDDLD:::,,,:.     .,ijfGGGDDDDDDDDDDDD *
 *ti;:::::::::..                      .:.,:              LDEEEEKKKKKKKWKKKKWWKKKKKKKKKKKKKKKKtKKWWWWKEEEEEEEEEDiiDEEEEEEEEWWEEEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEWKEEEEEDDDGL:. .:,,,:    .,ijLGGGDDDDDDDDDDDD *
 *tt;. .::::::::..                    ...,:             :fDEEEKKKKKKKKKKKKWW#KKKKKKKKKKKKKKKKfKKWWWWKEEEEEEEEDti,DEKEEEEEEWWEEEDEEEEEEEEEKEEEEEEEEEEEEEDEEEEE#WEEEEEGGDGf:.  .:,;,:.  .,ijLGGDDDDDDDDDDDDD *
 *tt;.   .:::::::..                   ...,:             GDEEEKKKKKKKKWKKKKWWWKKKWKKKKKKKWWWKDEKLWWWWKKEEEEEEDEi,LDEEEEEEEEWWEEEEEEEEEEEEEEEEEEEEEEEEEDEDEEEEEW#EEEEDDDDGf,.    :,,,:...,ijLGGGDDDDDDDDDDDD *
 *tt;.    .....::::..                 ...,:             fDEEEKKKKKKKKWKKKKWWWWKKKWKKKKKKKKKKfWKiWWW#KKEEEEEEEi;.EDfEEEDEEiWWEEEEEEEEEEEEDGKEEEEEEEEEEDEEEEEEEWWEEEEDDDGGLi.     .,;,:::,ijLGGGDDDDDDDDDDDD *
 *tt;.      ....:::::.                ...,.            iDEEEEKKKKKKKKWKKWKWWWWWKKWWWKKKKKKKKtWKt#WWWKKEEEEEDji..DDKDDEDEGiWKEEEEEEEEEEDDEjEEEEEEEEEEEDEEEEEEEKWKEEDDDDGGff.      .:,;,,;ijLGGGDDDDDDDDDDDD *
 *tt;.        ....::::..              .:.,:           .LDEEEKKKKKKKKKKKKWWWWKWWWWWWWWWWKKKKWtKKiDWWWKKKEEEEKi:..DEDDDDDDiiWKEEEEEEEEEEDDEijDEEEEEKEEEEEEEEEEEEWWEEGDDDGGLG.       .:,;;iijLGGGDDDDDDDDDDDD *
 *tt;.          .....:::..            ...,.           .fEEEEKKKKKKKKWKKKKWWWWWWWWWWWWWWKWKKKiKDiLWWWWKEEEEEi,..fD:DDDDDti;WEEEEEEEEEEKDDi:iDDEEEEWEEEEEEEEEEEE#WEEGDDDDGGG.         :,iitjLGGGDDDDDDDDDDDD *
 *tti.            .....:::..          ...,.           GDEEEKKKKKKKKKWKKKWWW#WWWWWWWWWWWKWKKjiEjitWWWKKWEEEDi...DDLDDDDji;;WEEEEEEEEEEEDEj.iDDEEEEWEEEEEEEEEEEEWWEEDDDDDDGf.          .,;tjfLGGDDDDDDDDDDDD *
 *tti.              ....::::..        ...,.           fEEEKKKKKKKKKKKKKKKW#WWWWWWWWWWWWWWWWtiEiiiWWWKKEWKEi....D.EDDDEi;.fWEEEEEEEEEEDDfL.;EDDEEEWEEEEEEEEEEEEWWEEEDDDDDGf.           :;ijfLGGDDDDDDDDDDDD *
 *tti.                ....::::..      ...,.          LDEEEKKKKKKKKKKKKKKWWWWWWWWWWWWWWWW####WKiiiWWWKKKEEK,...:E:DDDEii..GWEEEEEEEEDWDDiL.,KDDEEEWEEEEEEEEEEEEWWKEEDDDDDGf:           .,itfLGGDDDDDDDDDDDD *
 *tti.                 .....:::..     ...,.          fDEEEKKKKKKKKKWKKKKWWWWWWWWWWWWW########WLiiWWWKKKEEjD...G,DDDDi;...EWEEEEEEEEDKDEii..LDDEEEWEEEEEEEEEEEEWWWEEDDDDDGfi           .,;tfLGGGDDDDDDDDDDD *
 *tti.                   .....:::..   ...,.         iGEEEKKKKKKKKKKWKKKKWWWWWWWWWWWW###########KiWWWKKEEE,.D..D.DDDii:...KKEEEEEEEEEDDj:...tEDEEEWEEEEEEEEEEEEWWWEEEDDDDDLL           .,;tjLLGGDDDDDDDDDDD *
 *tti.                     ....::::......:.         LEEEKKKKKKKKKKWWKKKWWW#KWWWWWWWW#####W####W##KWWKKEEL..:D.jjDDi;,....KKEEEEEEEDfDDi...:iKDEEEWKEEEEEEEEEEEWWWEEEEDDDDLG           .,;tjLLGGDDDDDDDDDDD *
 *tti.                        ...::::::..,.        :GEEEKKKKKKKKKKKKWWWWW##WWWWWWWWW##WKWK#W#W####WWKEEK.....G.DDti,.....KKEEEEEEDWGDf.,...iKDEEEWWEEEEEEEEEEEW#WEEEEEDDDGL           .,;tjLLGGDDDDDDDDDDD *
 *tti.                         ....::::::,.        GDEEKKKKKKKKKKKKKWWWW###WWWWWWWWWW#WWWK###W#####WKEKK.....jDDL;;......KKEEEEEEEEEDi.f...;KDEEEWWEEEEEEEEEEEWWWWEEEEEDDGf           .,;tjLLGGDDDDDDDDDDD *
 *tti.                           ....:::,,.       .LEEEKKKKKWKKKKKWWWWWW###WWWWWWWWWW#WWKW#WW##W#WWWKEKD:....:DD:;......;KEEEEEEEKiDD..f...,KKEEEWWEEEEEEEEEEEWWWWEEEEEDDDf           .:;tjLLGGGDDDDDDDDDD *
 *tti.                             ...::,,,:.     GDEEKKKKKKKKKKKKWWWWWWW#WWWWWWWWWWW#KjKWWWWWWWWWWWWEK.j,..;fD.;.......fKEEEEEDKG:Di..,....DKEEEWWEEEEEEKEKKKWWWWEEEEEEDDf           .:;tjLLGGDDDDDDDDDDD *
 *jti.                              ...::,,,,:.  .fEEEKKKKKWKKKKKKWWWWWWW#WWWWWWWWWWK#KKKWWWWWWWWWWWWWK..f:.:G.,:.......EKEEEEEKK;:E:.......fKEEEWWKEKEKKKKKKKW#WWEEEEEEDDf:          .,;tfLLGGDDDDDDDDDDD *
 *tti.                               ...:,,,;;,: iDEEKKKKKWKKKKKKKWWWWWWW#WWWWWWWWWWK#WDKWWKKWWWWWWWWWE..;G:G..,........KKEEEEEKi.Gi..:.....tKEEKWWWKKKKKKKKKKW##WKEEEEEEDfi          .,;tfLLGGGDDDDDDDDDD *
 *tti.                               ....::,,;;;,LEEKKKKKKWKKKKKWWWWWWW###WWWWWWWWWWKWWDKWEEEWKKWWWWWKKj.:LG..;.........EKEEEEKG;.G...;.....;KKEKWWWKKKKKKKKKKW##WWKEEEEEDfL          .,;tfLGGGDDDDDDDDDDD *
 *jti.                                ...::::,;ijDEEKKKKKWKKKKKKWKWWWWW##WWWWWWWWWWWKK#KKGDGDWEEWKKWKKGE,.i;.:.........:EKEEEKE;.:L...j.....,KWEKWWWKKKKKKKKKK####WKKEEEEDLG          .,;tfLGGGGDDDDDDDDDD *
 *jti.                                ...:...,,;GEEKKKKKWWKKKKKWWWWWWWW###WWWWWWWWWKKKWWKiLGGEDEDEKGKKiEG..;...........jKEEEKK;:.G....,.....:KKEWWWWKKKKKKKWKK####WKKKKEEEGL          .,;tfLGGGGDDDDDDDDDD *
 *jti.                                ...:.  .:,GEEKKKKKWKKKKKWWWWWWWW####WWWWWWWWWKKKWWKii;fDLGDK: EEi:E:.............EKEEKK;;..L...........KKKWWWWKKKKKKKWKK####WKKKWKEEDf          .,;tfGGGGDDDDDDDDDDD *
 *jti.                                ...:.    ,EEKKKKKWWKKKKKWWWWWWWWW###WWWWWWWWKKKKfWWLt;i,. fi  EG..D:.............EKEKK;;..t....:.......KWKWWWWKKKKKKKWKK####WKKKWEEEDf:.        .,;tfGGGGDDDDDDDDDDD *
 *jti.                                ...:.    GEEKKKKKWKKKKKWWWWWWWWW####WWWWWWWKKKKKt;KKEfff     .;t.................KKKKi;:..GtGGfG.......KWWWWWWKKKKKKKWKK###WWWKKKKEEEf,,:       .,;tfGGGGDDDDDDDDDDD *
 *jti.                                ...:.    GEKKKKKWWKKKKKWWWWWWWWWW##WWWWWWWKKKKKKt;EiKKKK,   ...t................jEKKG;;..,.....,LGi....KWWWWWWKKKKKKWKKKW####WKKKKKEEL,,,:.     .,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:.  .GEEKKKKKWKKKKKWWWWWWWWWW###WWWWWWWKKKKKKtiE::tGG........................EEEj;;...,.........:D..DKWWWWWWKKKKK#KKW###W#WKKKKKEEfj:,,,:.   .,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:.   DEKKKKKWWKKKKKWWWWWWWWW####WWWWWWWKKKKKKiiE:::.::.......................EEi;;...j.....f......:iDKWWWWWWKKKKK#WW######WKKKKKEELG :,,,,:. .,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:.  fEEKKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKK;tE::..........................DD;.;,.::......;........EWWWWWWWKKKKW#WW#####WWKKKWKKELG  .:,,,:::,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:. .DEKEKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKE,iD::..........................D..,;.,;tLffi...........DWDWWWW#KKKWWWWW#####W#KKKWKEEGL    .:,;,,,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:. ;EEKKKKWWKKKKKWWWWWW#WWWW####WWWWWWKKKKKEL:iD:..........................j ..;..;;:.....i,........DKtWWWWWKKWWWWWW#####WWWKKKEKEDf     .:,;;;itfGGGDDDDDDDDDDDD *
 *jti.                                ...:. DEKKKKKWWKKKKWWWWWWW#WWWW####WWWWWWKKKKKEj:iG...............................:....................GKiWWWWWKKWW#WWW######WWKKKKKEEf       .,;iitfGGGDDDDDDDDDDDD *
 *jti.                                ...:.:EKKKKKWWKKKKKWWWWWWW#WWW#####WWWWWKWKKKKEi:if:.................................iEKEKKKKKKDj......DKiWWWWWKWK##WW#######WWKKK:KEEL        .:;itfGGGDDDDDDDDDDDD *
 *jji.                                ...:,DEEKKKWWWKWKKWWWWWWWWWWWW#####WWWWWWWKKKKEi:it..................................j.  KKKKKKKKKKKf..DKiWWWWWKWW##WW#######WWKKK,KEEf         .,;tfGGGDDDDDDDDDDDD *
 *jji.                                ..L:iDEEKKKWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKKi.i;..................................  . KKKWWWWWWWWK..DGiWWWWWKK##WWW#####W#WWKKKjEKEL,        .:;tfGGGDDDDDDDDDDDD *
 *jji.                               .f:::EEEKKKWWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKK;.i,.................................::  KKEKWWWWWWfWK..EiiWWWWWKWW#WW##########KKKD,KELj        .:;tfGGDDDDDDDDDDDDD *
 *jji.                             .t::::,DEEKKKWWKKKKWWWWWWWWW#WWWW#####WWWWKKWKKKEK;.i:.................................GDDEEEKKKWWWWWtWWD.E;iWWWWWW###WW#########WWKKK.EEDG        .:;tfGGGDDDDDDDDDDDD *
 *jji.                          . j..::::EKEKKKWWWKKKKWWWWWWWWW#WWW######WWWWKKWKKKEK;.t:.................................ELLEDDEEEWWWWEtWK,.KiiWWWWWW###W##########WWKKK:EEEG     .;tjfLLGDDDDDDDDDDDDDDD *
 *jji.                          i.::::::,EEEKKWWWKKKKKWWWWWWWWW#WWW#####WWWWWKWKKKKEE,.t..................................DfiEGDDDEEKKKttKWG.KiiWWWWW##WWW##########WWKKK:fEEL  ,fGGGDDDDDDDDEEEDDDDDDDDDD *
 *jji.                        .;:..:::::DEEEKKWWWKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKED,.t..................................ifjDDGGEGDKK.ttKKE.DiWWWWW###WW##########WWWKKK:.KELiLGGGGDDDDDDDDDDDDEEEDDDDDDD *
 *jji.                       i.:.::::::,KEEKKWWWKKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKEL:.j..................................GGf,;ifLLED .iiKKi:fWWWWWW##W#W##########WWWKKK:.KKLGGDDDDDDDDDDDDDDDDEDDEEDDDDD *
 *jji.                     .j:.::::::::EEEKKKWWWKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKf:.f..................................:EEfftf .,. ;iE,..jWWWWWWW###W############WWKKK,:KKGDDDDDDDDDDDDDDDDDDDDDDDEDDDD *
 *jji.                    .:.::::::::,,EEEKKWWWKKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKt..G....................................EEELL;   .j....tKWWWWWWW################WWWKKtfGKGEDDDDDDDDDDDDDDDDDDDDDDDEEDD *
 *jji.                   :...:::::::,,jEEKKWWWWKKKKKKWWWWWWWWW##KWW#####KWWWWWWKKKKEi..D....................................:jEEE.........;KKWWWWWWWW#WW##W##########WWKKDLGKEKDDDDDDDDDDDDDDDDDDDDDDDDDED *
 *jji.                  i:.::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWW##WWW#####WWWWWWWKKKKKi..D......................................:::::......,KKKWWWWWWWWW#####W########WWWKKKGGKKEGGGGGGGGDDDDDDDDDDDDDDDDDDE *
 *jji.                 i..:::::::::,,tEEKKWWWWKKKKKWWWWWWWWWWW##WW######WWWWWWWKKKKKi..D......................................::::......:EKKKWWWWWWWWWWW##WW########W#WKKWGGKKGGGGGGGGGGGGGGGDDDDDDDDDDDDD *
 *jji.                .:::::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWWW##WW#####WWWWWWWWKKKKKi..D....................................:::::::::..tELii;KWWWWWWWWWW##WW######WWWWWWKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGDG *
 *jjt.                :.::::::::,,,,fEEKKWWWWKKKKKKWWWWWWWWWW###WW####WWWWWWW#WKKKKKi..D....................................:::::::.:.,;;;;;;,KKWWWWWWWWW#WW########WWWKKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGGG *
 *jji.               ;.::::::::,,,,;EEEKWWWWWKKKKKWWWWWWWWWWWW##WW###WKWWWWWK#WKKKKKi..G......................................:::::::,;;;;:...KKKWWWWWWWWWKWW#######WWWWKKGLGKDGGGGGGLLGGGGGGGGGGGGGGGGGGG *
 *jjt.              f.:::::::::,,,,fEEKKWWWWWKKKKKWWWWWWWWWWW###WW##WKKWWWWWW#WKKKKK;.jt........i.............................:::::::;j;;....:E.KKKWWWWWWWKWW#####W#WWWWKKLLGWEEGGGGGLGGGGGGGGGGGGGGGGGGGG *
 *jjt.             ...:::::::,,,,,;DEEKWWWWWKKKKKWWWWWWWWWWWW####WWWKKKWWWWWWWWKKKKK;.E;.........t.............................:::::ii;;.....D...KKWWWWWWWKWW#####WWEWWWKKGGGEKKGGGGGLGGGGGGGGGGGGGLGGGGGG *
 *fji.             ;.:::::::,,,,,;LEEKKWWWWWKKKKKWWWWWWWWWWWW####KWKKKKWWWWWWWWKKKKKi.D;..........j.............................:::tt;,.....:.....KKWWWWWWKWWWW##WWWGWWWKKGGGGKEGGGGGGGGGGGGGGGGGGGLLGGGGL *
 *fji.            t::::::::,,,,,,;EEEKWWWWWKKKKKKKWWWWWWWWWWW##WKWKKKKKWWWWWWWWKKKKKi:D;............j...........................::LL;,.............KKWWWWWKWWWWWWWWWGWWWKKGGGGKGGGGGGGGGGGGGGGGGGGGLLGGGGL *
 *fjt:            .:::::::,,,,,,,DEEKWWWWWWKKKKKKKWWWWWWWWWWWWKKWKKKKKKWWWWK#WWKKKKWitE;........... ............................:G;;:...............KKKWWKKWWWWWWWWWGWWWKKGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGL *
 *fjji;:.       .f:::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWWKKKKKKKKKKKWWKWWWWWKKKKWGKD;........................................L;;..................DKKWKKWWWWWWWWWGWWWKKDGGGKDGGGGGGGGGGGGGGGGGGGGGGGGGG *
 *fjjtii;,:.     :::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWKKKKKKKKKKKKWWWWWW#WWKKKKWiEj;......................................:i,;....,...............;KKEKWWWWWWWWWGKWWKKDDGGDEGGGDGGGGGDGGGGGGGGGGGGGGGG *
 *fjtiiiii;;:.  j::::::,,,,,,,;;EEEKWWWWW#KKKKKWWWWWWWWWKKKKKKWKKKKKKKWWWWWWWWWKKKKWtEL;:....................................;;;:...,;j................:KEEWWWWWWWWWDDWWKKDDDDDKDDDDDDDDDDDDDDDGGGGGGGGGGG *
 *fjti;;iiii;;,:::::::,,,,,,,,;EEEKWWWWWWWKKKKWWWWWWWWKKKKKKKWKKKKKKKWWWWWWW#W#KKKKWEEii;...................................f;:....,;L...................EEKWWWWWWWWDDWWKKDDDDDKEDDDDDDDDDDDDDDDDDDDDDGGGG *
 *fjt,,,;;;;ii;f::::::,,,,,,,;;EEKWWWWWWWKKKKKWWWKWWKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWKEij;:...............................:G;,.....,;f....................:tKKWWWWWWWDDWWKKDDDDDKKDDDDDDDDDDDDDDDDDDDDDDDDD *
 *jjt. ..:,;;;;,::::,,,,,,,,;;GEEWWWWWWWWKKKKWKKWKKKKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWEDi;j;............................,Li;L;;;..,;;f........................KKKKWWWKDDWWKKDDDGDKKGGGGGGGGDGDDDDDDDDDDDDDDD *
 *fjt.    .:,,,:::::,,,,,,,;;;EEKWWWWWWWKKKKKKWKKKKKKKKKKKKKKKKKKKKKWKKKWKW##W#KKKKWEti;;G;........................tEEEL;;;;;;;;;;L..........................DKKKKKEDDWWKEDGftiLE;;;;itjLGGGGGGDDDDDDDDDDD *
 *fjt.       .j::::,,,,,,,;;;DEEWWWWWWWWKKKKWKKKKKKKKKKKKKKKKKKKKKKKWKKWWWK##W#KKKKKEii;;;L;...................iDEEEEEEKKi;j;;;;jD.....:......................,KKKKDGGEKKE:::::;E::::::::::,tLGGDDDDDDDDDD *
 *fjt.       .;:::,,,,,,,;;;;EEKWWWWWWWWKWKKKKKKKKKKKKKKKWKKKKKKKKKKWKKWWWW#WW#KKKKKKii;;;;f;.............:tDEEEEEKKKKKKKKEti;;;L...............................EEKf;:iKKE::::::E::::::::::::::ifDDDDDDDDD *
 *fjt:        :::,,,,,,,,;;;DEEWWWWWWWWWEKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####KKKKKEiii;;;;f,.........iDEEEEKKKKKKKKKKKKKKKf;iG......i..........................fK::::KKE::::::E::::::::::::::::,tGGDDDDD *
 *fjt:       t:::,,,,,,;;;;iDEKWWWWWWKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####WKKKKLiii;;;;;L,....,Li;EDEEEEKKKKKKKKKKKKKKKKiG......;:...........................:i:::KKE:::::,E,::::::::::::::::::iGDDDD *
 *jjt.       f::,,,,,,,;;;;GEEWWWWKEEKEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKWWWWW###WWKKKKiii;;;;;;;G,;L;;iiEEEEEEEKKKKKKKKKKKKKWWKE......;t.........:....................j::KEE:,::,,D,,::::,,,,,,:::::::::tDDD *
 *fjt:.      ,::,,,,,,,;;;;EEWWKEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKKWWWWW#W#KKKKKKiiiiii;;;;;i;;iiiEEKEEKKWKKKKKKKWKKKKKWWWGi;...;t......,;;;;,....................:,EEE,,,,,,D,,,,,,,,,,,,,,,,::,::::tG *
 *fjt:.     ,::,,,,,,,;;;;DEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWW#W#KKKKKKiiiii;;i;;;;;iiiKKKEKKKKWWKWWWWWWKKKKWWWWW;;;:;L.....;;;;;;;;;....................,KEE,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,; *
 *fjt:.     f:,,,,,,,;;;;jEDEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWW#W##KKKKKKiiiiiiii;i;;iiiEKKKKKKKKWKWWWWWWWWKKKWWWWWKi;;i.....,jEEfGi;;;;;...................EED,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,, *
 *fjt:.    .f::,,,,,,;;jEEDEEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWKWWWWW###KKKKKLiiiiiiiiiiiiiiEEKKKKKKKKWWWWWWWWWWWWKWWWWWWGi;i;,..;jDDDKEGi;;;;;;:................EED,,,,,,D,,,,,,,,,,,,,,,,,,,,,,,,, *
 *fjt:.  .. ;::,,,,,;;EDDEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKW#WW####KWKKKiiiiiiiiiiiiijKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWt;i;;;;i;DDDDDDGi;;;;;;;;:.............EDf;,,,;,G;;;;;;;;;;;;;;;,,,,,,,,,, *
 *fjt:......:,,,,,,;LDDDEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWWKWWWW####KKKKKiiiiiiiiiiijKEKKWKKKKKKKWWWWWWWWWWWWWWWWWWWWWWiLiii;i;DEEEEDDE;i;;;;;;;;;:..........EDi,;;;;;L;;;;;;;;;;;;;;;;;;,,,,,,, *
 *fjt:......:,,,,,;EDDDEEKEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKWWWWKKWWW##W#KWKKWEiiiiiijGKKKKKWWKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKi;iiiiDDEEEEEEDEi;;;;;;;;;;;;;,:.....ED;;;;;;;j;;;;;;;;;;;;;;;;;;;;;;;,, *
 *fjt:.....t,,,,,;DDDDEEEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKWWWW##WKWKKWKiiiKKKKKKKKKWWKKKKKKKKWWWWWWWWWWWWWWW#WWWWWWWWWiiiiifLEEEEEEEEDi;i;;;;;;;;;;;;.....DD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;; *
 *fjt:.....G,,,,,GDDDEEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKKWWWKKKWWW###WKWKKWKitKKKKKKKKKWKKKKKKKKKKWWWWWWWWWWWWWW###WWWWWWWWEiiiiiiiEEEEEEEEDGiiii;;;;;;;;;.....GD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;; *
 *fjt:.....L,,,,;GDDDEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWDGWWW###KKWWKWKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWW####WWWWWWWWWiiiiiiiiEEEEEEEEEEDi;i;;;;;;;;.....Lj;;;;;;i;iiiiii;;;;;;ii;;;;;;;;;;; *
 ***********************************************************************************************************************************************************************************************************/


#include <bits/stdc++.h>

#define fto(i, x, y) for(auto i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(auto i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(auto i = (x); i <= (y); i += a)
#define ftoit(it, var) for (auto it = var.begin(); it != var.end(); ++it)

#define ii pair<int, int>
#define mp make_pair
#define ff first
#define ss second

#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>

#define eb emplace_back
#define ef emplace_front
#define lb lower_bound
#define ub upper_bound

#define oo 1000000007
#define OO 1000000000000000007LL

using namespace std;

#define Pro "tmp"
#define maxN 300007

int l[maxN], r[maxN];

int main() {
	#ifndef ONLINE_JUDGE
        freopen(Pro".inp", "r", stdin);
        freopen(Pro".out", "w", stdout);
    #endif // ONLINE_JUDGE

    string s;
    cin >> s;

    int q = 0;
    fto(i, 0, (int)s.size()-1) if (s[i] == '?') ++q;

    set <int> st;
    fto(i, 0, (int)s.size()-1) if (s[i] >= 'A' && s[i] <= 'J') st.insert(s[i]);

    ll ans = 1LL;
    if (s[0] >= 'A' && s[0] <= 'J') ans = 9LL;
    else if (st.size()) ans = 10LL;

	fto(i, 2, (int)st.size()) ans *= 11-i;
	if (s[0] == '?') ans *= 9LL, --q;

	printf("%lld", ans);
	fto(i, 1, q) printf("0");

    return 0;
}


/*//DJ aka Dvij Joshi

            **************            *********************
            ****************          *********************
            ******      ******                   *****
            ******        ******                 *****
            ******        ******                 *****
            ******        ******                 *****
            ******        ******                 *****
            ******        ******       *****     *****
            ******       ******        *****     *****
            ******      ******         *****     *****
            ****************           ******* *******
            **************              *************
*/
//HEADERS---------------------------------
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//MACROS---------------------------------
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define hell 1000000007
#define M 998244353
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<long long>
#define vc  vector<char>
#define vs  vector<string>
#define mii map<int,int>
#define mll map<long long,long long>
#define mci map<char,int>
#define pii pair<int,int>
#define msi map<string,int>
#define loop(i,a,b) for(i=a;i<b;++i)
#define rloop(i,a,b) for(i=a;i>b;--i)
#define in(i,a,n) for(i=0;i<n;++i) cin>>a[i];
#define out(i,a,n) for(i=0;i<n;++i) cout<<a[i]<<" ";
#define ll long long
#define sp(n) setprecision(n)
#define fin freopen( "input.txt", "r", stdin );
#define fout freopen( "output.txt", "w", stdout );
#define outall(a) loop(i,0,sizeof(a)/sizeof(a[0])) cout<<a[i]<<" "; cout<<endl
#define endl "\n"
#define int long long
using namespace __gnu_pbds;
using namespace std;
const long double pi=acos(-1.0);
//GLOBALS--------------------------------------

//FUNCTIONS------------------------------------
/*int rollinghash(string s)
{
	int match = 1;

int ha1 = 0, ha2 = 0, hr1 = 0, hr2 = 0;
int m1 = 1, m2 = 1;
for ( int i = 0; i<s.size(); ++i )
{
    ha1 = (ha1 + m1*(s[i]-'a')) % mod1;
    ha2 = (ha2 + m2*(s[i]-'a')) % mod2;

    hr1 = (s[i]-'a' + base1*hr1) % mod1;
    hr2 = (s[i]-'a' + base2*hr2) % mod2;

    m1 *= base1, m1 %= mod1;
    m2 *= base2, m2 %= mod2;

    if ( ha1 == hr1 && ha2 == hr2 )
        match = i;
}
return match+1;
}*/

void DJ()
{
	string s;
	cin>>s;
	set<char> s1;
	int q=0;
	for(auto i:s)
	{
		if(i>='A'&&i<='J') s1.insert(i);
		if(i=='?') q++;
	}
	if(s[0]=='?')
	{
		int k=10,n=9,i;
		loop(i,0,s1.size())
		{
			n*=k--;
		}
		cout<<n;
		loop(i,0,q-1) cout<<0;
	}
	else if(s[0]>='A'&&s[0]<='J')
	{
		int n=9,k=9,i;
		loop(i,1,s1.size())
		{
			n*=k--;
		}
		cout<<n;
		loop(i,0,q) cout<<0;
	}
	else
	{
		int n=1,k=10,i;
		loop(i,0,s1.size())
		{
			n*=k--;
		}
		cout<<n;
		loop(i,0,q) cout<<0;
	}
}
//MAIN FUNCTION--------------------------------
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t=1,i;
	// cin>>t;
	// fin fout
	while(t--) DJ();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vs vector<string>
#define vll vector<ll>
#define ii pair<int, int>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR(i, x, n) for(int i=x; i<=n; ++i)
#define ROF(i, x, n) for(int i=x; i>=n; --i)
#define MOD 1000000007
#define F first
#define S second
#define all(x) x.begin(), x.end()

int a[10];

int main() {

    string  s;
    cin>>s;

    iota(a, a+10, 0);

    if(s[0] == '?') {
        s[0] = '1';
    }
    else if(s[0] >= 65) {
        if(s[0] == 'A') {
            swap(a[0], a[1]);
        }
        else {
            swap(a[s[0] - 65], a[s[0] - 66]);
        }
    }

    for(auto c: s) {
        if(c >= 65) {
            printf("%c", '0'+a[c - 65]);
        }
        else if(c == '?') {
            printf("1");
        }
        else {
            printf("%c", c);
        }
    }
    printf("\n");
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vs vector<string>
#define vll vector<ll>
#define ii pair<int, int>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR(i, x, n) for(int i=x; i<=n; ++i)
#define ROF(i, x, n) for(int i=x; i>=n; --i)
#define MOD 1000000007
#define F first
#define S second
#define all(x) x.begin(), x.end()

bool a[300] = {false};

int main() {

    string  s;
    cin>>s;

    ll ans = 1;

    if(s[0] == '?' || s[0] >= 65) {
        ans *= 9;
        a[s[0]] = 1;
    }

    FOR(i, 1, s.size() - 1) {
        if(s[i] == '?') {
            ans *= 10;
        }
        else if(s[i] >= 65 && !a[s[i]]) {
            int co = 0;
            FOR(j, 65, 74) {
                if(!a[j]) {
                    co++;
                }
            }

            ans *= max(co, 1);
            a[s[i]] = 1;
        }
    }

    printf("%lld\n", ans);
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vs vector<string>
#define vll vector<ll>
#define ii pair<int, int>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR(i, x, n) for(int i=x; i<=n; ++i)
#define ROF(i, x, n) for(int i=x; i>=n; --i)
#define MOD 1000000007
#define F first
#define S second
#define all(x) x.begin(), x.end()

bool a[300] = {false};

int main() {

    string  s;
    cin>>s;

    ll ans = 1;

    if(s[0] == '?' || s[0] >= 65) {
        ans *= 9;
        a[s[0]] = 1;
    }

    int z = 0;

    FOR(i, 1, s.size() - 1) {
        if(s[i] == '?') {
            z++;
        }
        else if(s[i] >= 65 && !a[s[i]]) {
            int co = 0;
            FOR(j, 65, 74) {
                if(!a[j]) {
                    co++;
                }
            }

            ans *= max(co, 1);
            a[s[i]] = 1;
        }
    }
    printf("%lld", ans);

    FOR(i, 1, z) {
        printf("0");
    }
    printf("\n");
}


// In the name of God.
// We're nothing and you're everything.
// Ya Ali!

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e4 + 14;

int main(){
	ios::sync_with_stdio(0), cin.tie(0);
	string s;
	cin >> s;
	int cnt = 0;
	int ans = 1;
	int qMarks = count(s.begin(), s.end(), '?');
	for(char l = 'A'; l <= 'J'; l++)
		cnt += count(s.begin(), s.end(), l) > 0;
	if(s[0] >= 'A' && s[0] <= 'J')
		for(int i = 0; i < cnt; i++)
			ans *= min(9, 10 - i);
	else
		for(int i = 0; i < cnt; i++)
			ans *= 10 - i;
	if(s[0] == '?')
		ans *= 9, qMarks--;
	cout << ans << string(qMarks, '0') << '\n';
}


// みなさん私はカーティキー・シャルマです。LNMIITで勉強しています。私は2年目で、コロナパンデミックが発
// 生しています。世界は終わりそうだ。だから私はそれを最大限に生きたいと思っています。それはつまり、コー
// ドを最大限に意味しているのです。私の好きなアニメは「キメツノヤイバ」で、私の一番の男の子はゼニツで、
// 私の一番の女の子はネズコです。私の好きな呼吸スタイルは息吹です。私の最高の悪魔の血の芸術は、
// ククシボによって使用される月の息です。ムーザンは亡くなり、今ではタンジローがポップの新しい魔王です。
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(lld i = 0; i < n; i+=1)
#define fod(i,n) for(lld i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
      #ifndef ONLINE_JUDGE
      freopen("inputf.in",  "r",  stdin);
      freopen("outputf.in", "w", stdout);
      #endif
      FastIO
      string s;
      cin >> s;
      lld n = s.length();
      map <char , lld> m;
      lld prod = 1;
      for(lld i = 0; i < n; i += 1){
            if (s[i] == '?'){
                  prod *= (i == 0 ? 9 : 10);
            }
            if (s[i] >= 'A' && s[i] <= 'J'){
                  if (!m.count(s[i]))
                        m[s[i]] = i;
            }
      }
      lld f = 0;
      for(map <char, lld> :: iterator itr = m.begin(); itr != m.end(); itr++){
            if (itr->second == 0){
                  f = 1;
            }
      }
      if (f == 0){
            lld x = 10;
            lld len = m.size();
            while(len != 0){
                  prod*= x;
                  len -= 1;
                  x--;
            }
      }
      else{
            lld x = 9;
            prod *= 9;
            lld len = m.size()-1;
            while(len != 0){
                  prod*= x;
                  len -= 1;
                  x--;
            }
      }
      cout << prod;
      return 0;
}


// みなさん私はカーティキー・シャルマです。LNMIITで勉強しています。私は2年目で、コロナパンデミックが発
// 生しています。世界は終わりそうだ。だから私はそれを最大限に生きたいと思っています。それはつまり、コー
// ドを最大限に意味しているのです。私の好きなアニメは「キメツノヤイバ」で、私の一番の男の子はゼニツで、
// 私の一番の女の子はネズコです。私の好きな呼吸スタイルは息吹です。私の最高の悪魔の血の芸術は、
// ククシボによって使用される月の息です。ムーザンは亡くなり、今ではタンジローがポップの新しい魔王です。
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(lld i = 0; i < n; i+=1)
#define fod(i,n) for(lld i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
      #ifndef ONLINE_JUDGE
      freopen("inputf.in",  "r",  stdin);
      freopen("outputf.in", "w", stdout);
      #endif
      FastIO
      string s;
      cin >> s;
      lld n = s.length();
      map <char , lld> m;
      vector <lld> v;
      v.push_back(1);
      for(lld i = 0; i < n; i += 1){
            if (s[i] == '?'){
                  if (i == 0) v[0]*=9;
                  else v.push_back(0);
            }
            if (s[i] >= 'A' && s[i] <= 'J'){
                  if (!m.count(s[i]))
                        m[s[i]] = i;
            }
      }
      lld f = 0;
      for(map <char, lld> :: iterator itr = m.begin(); itr != m.end(); itr++){
            if (itr->second == 0){
                  f = 1;
            }
      }
      if (f == 0){
            lld x = 10;
            lld len = m.size();
            while(len != 0){
                  v[0]*= x;
                  len -= 1;
                  x--;
            }
      }
      else{
            lld x = 9;
            v[0] *= 9;
            lld len = m.size()-1;
            while(len != 0){
                  v[0]*= x;
                  len -= 1;
                  x--;
            }
      }
      foi(i,v.size()) cout<<v[i];
      return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

// If I need to find (x / a) % b, I need to use this function:
//    (x / a) % b = (x * inv(a, b)) % b
ll inv(ll a, ll b) {
  if (a != 1) {
    return b - (inv(b % a, a) * b) / a;
  }
  return 1;
}

inline int Pow(int a, int k) {
  int s = 1;
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

// Init variables here
const int N = 1e6 + 7;

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
}

void output() {

}

void preprocess() {

}

void debug() {
  if (true) {

  }
}

bool done[10];

void solve() {
  preprocess();
  string s;
  cin >> s;
  int res = 1, cnt = 10;
  if ('A' <= s[0] and s[0] <= 'J') {
    res = 9; cnt = 9;
    done[s[0] - 'A'] = true;
  } else if (s[0] == '?') {
    res = 9;
  }
  int n = s.length(), tail = 0;
  FOR(i, 1, n) {
    if ('A' <= s[i] and s[i] <= 'J') {
      int id = s[i] - 'A';
      if (!done[id]) {
        res *= cnt--;
        done[id] = true;
      }
    } else if (s[i] == '?') {
      tail++;
    }
  }
  cout << res;
  FOR(i, 0, tail) {cout << 0;}
  cout << endl;
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

#undef int
int main() {
#define int long long
  ios_base::sync_with_stdio(false);
  cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--)
  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

// If I need to find (x / a) % b, I need to use this function:
//    (x / a) % b = (x * inv(a, b)) % b
ll inv(ll a, ll b) {
  if (a != 1) {
    return b - (inv(b % a, a) * b) / a;
  }
  return 1;
}

inline int Pow(int a, int k) {
  int s = 1;
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

// Init variables here
const int N = 1e6 + 7;

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
}

void output() {

}

void preprocess() {

}

void debug() {
  if (true) {

  }
}

bool done[10];

void solve() {
  preprocess();
  string s;
  cin >> s;
  int res = 1, cnt = 10;
  if ('A' <= s[0] and s[0] <= 'J') {
    res = 9; cnt = 9;
    done[s[0] - 'A'] = true;
  } else if (s[0] == '?') {
    res = 9;
  }
  int n = s.length();
  int tail = 0; // Key implementation detail to avoid dealing with big ints
  FOR(i, 1, n) {
    if ('A' <= s[i] and s[i] <= 'J') {
      int id = s[i] - 'A';
      if (!done[id]) {
        res *= cnt--;
        done[id] = true;
      }
    } else if (s[i] == '?') {
      tail++;
    }
  }
  cout << res;
  FOR(i, 0, tail) {cout << 0;}
  cout << endl;
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

#undef int
int main() {
#define int long long
  ios_base::sync_with_stdio(false);
  cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--)
  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


#include <iostream>
#include <set>
#include <cmath>

using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 1;
    set<char> arr;

    for(int i=0; i<s.size(); i++){
        if(s[i] == '?'){
            ans *= 10;
        }else if(s[i] < 75 && s[i] > 64){
            arr.insert(s[i]);
        }
    }
    for(int i=0; i<arr.size(); i++){
        ans *= (10-i);
    }
    if(s[0] == '?' || (s[0] < 75 && s[0] > 64)){
        ans /= 10;
        ans *= 9;
    }
    cout << ans;
}


#include <iostream>
#include <set>
#include <cmath>

using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 1;
    int ans1 = 0;
    set<char> arr;

    for(int i=0; i<s.size(); i++){
        if(s[i] == '?'){
            ans1++;
        }else if(s[i] < 75 && s[i] > 64){
            arr.insert(s[i]);
        }
    }
    for(int i=0; i<arr.size(); i++){
        ans *= (10-i);
    }
    if(s[0] < 75 && s[0] > 64){
        ans /= 10;
        ans *= 9;
    }else if(s[0] == '?'){
        ans *= 9;
        ans1--;
    }
    cout << ans;
    for(int i=0; i<ans1; i++){
        cout << 0;
    }
}


#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<vvvi> vvvvi;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    ll ans = 1;
    map<char, int> M;
    int c10 = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '?') {
            if (i == 0) ans *= 9;
            else c10++;
        }
        if (s[i] >= 'A' && s[i] <= 'J') M[s[i]]++;
    }
    int cur = 10;
    for (int i = 0; i < M.size(); ++i) {
        if (i == 0 && s[i] >= 'A' && s[i] <= 'J') ans *= 9;
        else ans *= cur;
        cur--;
    }
    cout << ans;
    for (int i = 0; i < c10; ++i) cout << 0;
    cout << "\n";
    return 0;
}


#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<vector>
#include <iterator>
#include <set>
#include <stack>

#define mx(ans, cnt) ans = max(ans, cnt)
#define fauto(a) for(auto i : a) cout << i << " "; cout << endl;
#define sp(n) fixed << setprecision(n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define _ << " " <<
#define swp(x, y) if (x > y) swap(x, y);
#define swpg(x, y) if (x < y) swap(x, y);
#define ff first

#define ss second
#define xx first
#define yy second
#define pb push_back
#define pf push_front
#define nn end1
#define intmax ((1ll << 32) - 1)
#define f(k) k * (k - 1) * (k - 2) * (k - 3) / 24

using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using ull = unsigned long long;

//while (l < r) {
//    int mid = (r + l + 1) / 2;      правый
//    if (a[mid] > x) r = mid - 1;
//    else l = mid;
//}
//while (l < r) {
//    int mid = (r + l) / 2;          левый
//    if (a[mid] >= x) r = mid;
//    else l = mid + 1;
//}

//ll gcd(ll a, ll b) {
//    if (b == 0) return a;
//    return gcd(b, a % b);
//}

int main() {

    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //setlocale(LC_ALL, "Russian");

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    int cnt = 10;

    int k = 0;
    vector<int> a(15);
    ull ans = 1;
    int n = (int)s.size();
    for (int i = 0; i < n; i++) {
        if (s[i] == '?') {
            if (!i) ans *= 9;
            else k++;
        }
        else if (s[i] >= 'A' && s[i] <= 'J' ) {
            if (i) ans *= (!a[s[i] - 'A']++ ? cnt-- : 1);
            else {
                ans *= 9;
                cnt--;
                a[s[i] - 'A']++;
            }
        }
    }

    cout << ans;

    for (int i = 0; i < k; i++)
        cout << 0;
    cout << endl;

#ifdef LOCAL_DEBUG
    cerr << "Execution time: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

/*
 ╔═════════════════════════════════════════════════════════════════════════════════════════╗
 ║                                                                                ║
 ║  ║███████║  ║█████║    ║████║   ║██████║      ║████║ ║██║  ║██║ ║██║    ║██║   ║█████║  ║
 ║  ║██║     ║██║       ║██║  ║██║ ║██║  ║██║  ║██║║██║ ║██║║██║   ║██║    ║██║ ║██║       ║
 ║  ║████║  ║██║  ║███║ ║██║  ║██║ ║███║║██║  ║██║ ║██║ ║████║     ║██║    ║██║   ║████║   ║
 ║  ║██║    ║██║   ║██║ ║██║  ║██║ ║██║██║   ║█████████║║██║║██║    ║██║  ║██║        ║██║ ║
 ║  ║███████║ ║██████║    ║████║   ║██║ ║██║       ║██║ ║██║  ║██║    ║████║     ║█████║   ║
 ║                                                                                ║
 ╚═════════════════════════════════════════════════════════════════════════════════════════╝
 */

/*
 n!

    n!
 --------
 (n - k)!

      n!
 ------------
 k! * (n - k)!
 */


#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<vector>
#include <iterator>
#include <set>
#include <stack>

#define mx(ans, cnt) ans = max(ans, cnt)
#define fauto(a) for(auto i : a) cout << i << " "; cout << endl;
#define sp(n) fixed << setprecision(n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define _ << " " <<
#define swp(x, y) if (x > y) swap(x, y);
#define swpg(x, y) if (x < y) swap(x, y);
#define ff first

#define ss second
#define xx first
#define yy second
#define pb push_back
#define pf push_front
#define nn end1
#define intmax ((1ll << 32) - 1)
#define f(k) k * (k - 1) * (k - 2) * (k - 3) / 24

using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using ull = unsigned long long;

//while (l < r) {
//    int mid = (r + l + 1) / 2;      правый
//    if (a[mid] > x) r = mid - 1;
//    else l = mid;
//}
//while (l < r) {
//    int mid = (r + l) / 2;          левый
//    if (a[mid] >= x) r = mid;
//    else l = mid + 1;
//}

//ll gcd(ll a, ll b) {
//    if (b == 0) return a;
//    return gcd(b, a % b);
//}

int main() {

    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //setlocale(LC_ALL, "Russian");

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    int cnt = 10;

    vector<int> a(15);
    ull ans = 1;
    int n = (int)s.size();
    for (int i = 0; i < n; i++) {
        if (s[i] == '?') ans *= (!i ? 9 : 10);
        else if (s[i] >= 'A' && s[i] <= 'J' ) {
            if (i) ans *= (!a[s[i] - 'A']++ ? cnt-- : 1);
            else {
                ans *= 9;
                cnt--;
                a[s[i] - 'A']++;
            }
        }
    }

    cout << ans << endl;

#ifdef LOCAL_DEBUG
    cerr << "Execution time: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

/*
 ╔═════════════════════════════════════════════════════════════════════════════════════════╗
 ║                                                                                ║
 ║  ║███████║  ║█████║    ║████║   ║██████║      ║████║ ║██║  ║██║ ║██║    ║██║   ║█████║  ║
 ║  ║██║     ║██║       ║██║  ║██║ ║██║  ║██║  ║██║║██║ ║██║║██║   ║██║    ║██║ ║██║       ║
 ║  ║████║  ║██║  ║███║ ║██║  ║██║ ║███║║██║  ║██║ ║██║ ║████║     ║██║    ║██║   ║████║   ║
 ║  ║██║    ║██║   ║██║ ║██║  ║██║ ║██║██║   ║█████████║║██║║██║    ║██║  ║██║        ║██║ ║
 ║  ║███████║ ║██████║    ║████║   ║██║ ║██║       ║██║ ║██║  ║██║    ║████║     ║█████║   ║
 ║                                                                                ║
 ╚═════════════════════════════════════════════════════════════════════════════════════════╝
 */

/*
 n!

    n!
 --------
 (n - k)!

      n!
 ------------
 k! * (n - k)!
 */


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

int main()
{
	std::string s;
	std::cin >> s;
	int n = s.size();
	long long result = 1;
	std::vector<bool> letters('J' - 'A' + 1);
	for (int i = 0; i < n; i++)
	{
		if (s[i] >= 'A' && s[i] <= 'J')
			letters[s[i] - 'A'] = true;
	}

	int valToMult = 10;
	for (int i = 0; i < letters.size(); i++)
	{
		if (letters[i]) {
			if (valToMult == 10 && s[0] >= 'A' && s[0] <= 'J') {
				result *= 9;
			}
			else {
				result *= valToMult;
			}
			valToMult--;
		}
	}

	if (s[0] == '?')
		result *= 9;

	std::cout << result;

	for (int i = 1; i < n; i++)
	{
		if (s[i] == '?')
			std::cout << 0;
	}
}


// https://codeforces.com/problemset/problem/316/A2#

#include<bits/stdc++.h>
#include<math.h>
using namespace std;

int AtoJ[10] = {0};

int lcount = 0; // count distinct letters
int qmcount = 0; // count ?s

int main()
{
	string s;
	cin >> s;

	for(int i = 0; s[i] != '\0'; i++)
	{
		// we can ignore numbers
		if (isalpha(s[i]))
		{
			AtoJ[s[i] - 65] = 1;
		}

		else if (s[i] == '?')
		{
			qmcount ++;
		}
	}

	for(int i = 0 ; i < 10 ; i++)
	{
		lcount += AtoJ[i];
	}

	int ans = 1;

	for(int i = 0; i < lcount; i++)
	{
		ans *= (10 - i);
	}

	ans *= pow(10, qmcount);

	// no leading 0; gives us 9 options
	if (isalpha(s[0]))
	{
		ans = ans / 10 * 9;
	}

	cout << ans;

}


// https://codeforces.com/problemset/problem/316/A2#

#include<bits/stdc++.h>
using namespace std;

int AtoJ[10] = {0};

int lcount = 0; // count distinct letters
int qmcount = 0; // count ?s

int main()
{
	string s;
	cin >> s;

	for(int i = 0; s[i] != '\0'; i++)
	{
		// we can ignore numbers
		if (isalpha(s[i]))
		{
			AtoJ[s[i] - 65] = 1;
		}

		else if (s[i] == '?')
		{
			qmcount ++;
		}
	}

	for(int i = 0 ; i < 10 ; i++)
	{
		lcount += AtoJ[i];
	}

	int ans = 1;

	for(int i = 0; i < lcount; i++)
	{
		ans *= (10 - i);
	}

	// no leading 0; gives us 9 options
	if (isalpha(s[0]) || s[0] == '?')
	{
		ans = ans / 10 * 9;
		if(s[0] == '?')
		{
			qmcount--;
		}
	}

	cout << ans;

	for(int i = 0 ; i < qmcount; i++)
	{
		cout << 0;
	}

}


// https://codeforces.com/problemset/problem/316/A2#

#include<bits/stdc++.h>
#include<math.h>
using namespace std;

int AtoJ[10] = {0};

int lcount = 0; // count distinct letters
int qmcount = 0; // count ?s

int main()
{
	string s;
	cin >> s;

	for(int i = 0; s[i] != '\0'; i++)
	{
		// we can ignore numbers
		if (isalpha(s[i]))
		{
			AtoJ[s[i] - 65] = 1;
		}

		else if (s[i] == '?')
		{
			qmcount ++;
		}
	}

	for(int i = 0 ; i < 10 ; i++)
	{
		lcount += AtoJ[i];
	}

	int ans = 1;

	for(int i = 0; i < lcount; i++)
	{
		ans *= (10 - i);
	}

	ans *= pow(10, qmcount);

	// no leading 0; gives us 9 options
	if (isalpha(s[0]) || s[0] == '?')
	{
		ans = ans / 10 * 9;
	}

	cout << ans;

}


// https://codeforces.com/problemset/problem/316/A2#

#include<bits/stdc++.h>
using namespace std;

int AtoJ[10] = {0};

int lcount = 0; // count distinct letters
int qmcount = 0; // count ?s

int main()
{
	string s;
	cin >> s;

	for(int i = 0; s[i] != '\0'; i++)
	{
		// we can ignore numbers
		if (isalpha(s[i]))
		{
			AtoJ[s[i] - 65] = 1;
		}

		else if (s[i] == '?')
		{
			qmcount ++;
		}
	}

	for(int i = 0 ; i < 10 ; i++)
	{
		lcount += AtoJ[i];
	}

	int ans = 1;

	if (s[0] == '?')
	{
		ans = 9;
		qmcount--;
	}

	for(int i = 0; i < lcount; i++)
	{
		ans *= (10 - i);
	}

	// no leading 0; gives us 9 options
	if (isalpha(s[0]))
	{
		ans = ans / 10 * 9;
	}

	cout << ans;

	for(int i = 0 ; i < qmcount; i++)
	{
		cout << 0;
	}

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 100001
#define maxc 10

ll cal(ll n, ll k) {
	ll ret = 1;
	while(n--) ret *= k--;
	return ret;
}
char s[maxn];
bool vit[maxc];

int main() {
	ll n, i, q = 0, num = 0, ret;
	scanf("%s", s);
	n = strlen(s);
	for (i = 0; i < n; i++) {
		q += s[i] == '?';
		if ('A' <= s[i] && s[i] <= 'J')
			vit[s[i] - 'A'] = true;
	}
	for (i = 0; i < maxc; i++)
		num += vit[i];
	if (s[0] == '?') {
		ret = 9 * pow(10, q - 1) * cal(num, 10);
	} else if ('A' <= s[0] && s[0] <= 'J') {
		ret = 9 * pow(10, q) * cal(num - 1, 9);
	} else {
		ret = pow(10, q) * cal(num, 10);
	}
	printf("%lld", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 100001
#define maxc 10

ll cal(ll n, ll k) {
	ll ret = 1;
	while(n--) ret *= k--;
	return ret;
}
char s[maxn];
bool vit[maxc];

int main() {
	ll n, i, q = 0, num = 0, ret;
	scanf("%s", s);
	n = strlen(s);
	for (i = 0; i < n; i++) {
		q += s[i] == '?';
		if ('A' <= s[i] && s[i] <= 'J')
			vit[s[i] - 'A'] = true;
	}
	for (i = 0; i < maxc; i++)
		num += vit[i];
	if (s[0] == '?') {
		ret = 9 * cal(num, 10);
		q--;
	} else if ('A' <= s[0] && s[0] <= 'J') {
		ret = 9 * cal(num - 1, 9);
	} else {
		ret = cal(num, 10);
	}
	for (i = 0; i < q; i++)
		s[0] = '0';
	s[q] = '\0';
	printf("%lld%s", ret, s);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 100001
#define maxc 10

ll cal(ll n, ll k) {
	ll ret = 1;
	while(n--) ret *= k--;
	return ret;
}
char s[maxn];
bool vit[maxc];

int main() {
	ll n, i, q = 0, num = 0, ret;
	scanf("%s", s);
	n = strlen(s);
	for (i = 0; i < n; i++) {
		q += s[i] == '?';
		if ('A' <= s[i] && s[i] <= 'J')
			vit[s[i] - 'A'] = true;
	}
	for (i = 0; i < maxc; i++)
		num += vit[i];
	if (s[0] == '?') {
		ret = 9 * cal(num, 10);
		q--;
	} else if ('A' <= s[0] && s[0] <= 'J') {
		ret = 9 * cal(num - 1, 9);
	} else {
		ret = cal(num, 10);
	}
	for (i = 0; i < q; i++)
		s[i] = '0';
	s[q] = '\0';
	printf("%lld%s", ret, s);
	return 0;
}


//move on rick
#include<bits/stdc++.h>
using namespace std;
#define    ll    long long int
/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
ll m,n,c,d,j,k,l,r,x,t,y,u,b,z,i,e,f,g,h;
int main ()
{
string s;
cin>>s;map<char,ll> mp;
for(i=0;i<s.size();i++){
    if(!mp[s[i]]) mp[s[i]]=i+1;
    cout<<mp[s[i]];
   // else mp[s[i]
}
}


//move on rick
#include<bits/stdc++.h>
using namespace std;
#define    ll    long long int
/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
ll n,c=1,d,j,k,l,r,x,t,y,u,b,z,i,e,f,g,h;
map<char,ll> m;
int main ()
{
    string s;
    cin>>s;
    if(s[0]>='A'&&s[0]<='J')
    {
        c = 9;
        m[s[0]] = 9;
    }
    else if(s[0]=='?')
    {
        c= 9;
    }
    for(i=1; i<s.size(); ++i)
    {
        if(s[i]>='A'&&s[i]<='J'&&!m.count(s[i]))
        {
            c *= (10-m.size());
            m[s[i]] = 10 - m.size();
        }
        else if(s[i]=='?')
        {
            ++d;
        }
    }
    cout<<c;
    while(d--)
    {
        cout<<0;
    }
}


#include <bits/stdc++.h>
#define pii pair <int, int>

using namespace std;

const int MAXX = 2e5 + 10;
int n, k, ans;
pii a[MAXX];

bool cmp(pii x, pii y) {
	return ((x.first - x.second) < (y.first - y.second));
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> a[i].first;
	for(int i = 0; i < n; i++)
		cin >> a[i].second;
	sort(a, a + n, cmp);
	for(int i = 0; i < k; i++)
		ans += a[i].first;
	for(int i = k; i < n; i++)
		ans += min(a[i].first, a[i].second);
	return cout << ans << endl, 0;
}


#include <bits/stdc++.h>

using namespace std;

int ans = 1, cnt, mult = 10, cnt_z;
string txt;
bool flag, mark[36];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> txt;
	for(int i = 0; i < txt.size(); i++) {
		if(txt[i] == '?') {
			cnt_z++;
			if(!i)
				flag = 1;
		}
		else if(txt[i] >= 'A' && txt[i] <= 'J' && !mark[txt[i] - 'A']) {
			cnt++, mark[txt[i] - 'A'] = 1;
			if(!i)
				flag = 1;
		}
	}
	for(int i = 0; i < cnt; i++)
		ans *= mult, mult--;
	if(cnt_z)
		ans *= 10, cnt_z--;
	if(flag)
		ans = (ans / 10) * 9;
	cout << ans;
	for(int i = 0; i < cnt_z; i++)
		cout << 0;
	return cout << endl, 0;
}


#include <bits/stdc++.h>
using namespace std;
string st;
map<char,int> m;
long long ans=1, cnt, d;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>st;
    if(st[0]>='A'&&st[0]<='J'){
        ans = 9;
        m[st[0]] = 9;
    }else if(st[0]=='?'){
        ans = 9;
    }
    for(int i=1;i<st.size();++i){
        if(st[i]>='A'&&st[i]<='J'&&!m.count(st[i])){
            ans *= (10-m.size());
            m[st[i]] = 10 - m.size();
        }else if(st[i]=='?'){
            ++cnt;
        }
    }
    cout<<ans;
    while(cnt--){
        cout<<0;
    }
}


#include <bits/stdc++.h>
#define int long long
#define YES cout<<"YES\n";return;
#define NO cout<<"NO\n";return;
#define write(a) cout<<a<<"\n";return;
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);
    long long powmod(long long a,long long b,long long mod) {
        if (b==0 || a==1)  {if (mod==1) return 0; else return 1; }

        if (b%2==0) { long long k=powmod(a,b/2,mod); return (k*k)%mod; }
        else {long long k=powmod(a,b/2,mod); return ( (k*k) %mod *a)% mod; }
    }
    long long gcd(long long a, long long b) {
        if (a==0) return b;
        if (b==0) return a;
        if (a>b) return gcd(a%b,b); else return gcd(b%a,a);
    }
      int prime(int p) { // 1 - простое
        for (int i=2;i*i<=p;i++) {
            if (p%i==0 && i<p) return i;
        }
        return 1;
    }

     int inv(int a, int mod) {
        return powmod(a,mod-2,mod);
    }

  int random_modul() {

    uniform_int_distribution <int> u1(1e9, 2e9);
    int pepega=u1(rnd);
    while (prime(pepega)!=1) pepega=u1(rnd);
    return pepega;
}

int mod;

    void solve () {

         /* --------- */

       string s;
       cin>>s;
       int a=s.size();
       map <char, int> cur;
       int ans=0;
       int ch=0;
       for (int i=0;i<s.size();i++) {
          if (s[i]>='A' && s[i]<='Z') {if (cur[s[i]]==0) ch++; cur[s[i]]++; }
          if (s[i]=='?') ans++;
       }
       int kek=1;
       int check=0;
       if (s[0]=='?' || (s[0]>='A' && s[0]<='Z')) {
           check=1;
       }
       if (s[0]=='?') kek*=9;
       //if (check==1) kek*=9;
       for (int i=1;i<=ch;i++) {
            if (s[0]>='A' && s[0]<='Z' && i==1) kek*=9; else kek*=11-i;
       }
       ans-=(s[0]=='?');
       cout<<kek; for (int i=0;i<ans;i++) cout<<"0";
         /* --------- */
            return;
    }

    signed main() {
       ios_base::sync_with_stdio(0);
       cin.tie(0);
       cout.tie(0);

         // cout<<fixed<<setprecision(10);

          int tututu;
          tututu=1;

          mod=random_modul();
         // cin>>tututu; // если нет запросов, то закоментить

          for (int qwerty=0;qwerty<tututu;qwerty++) solve();

        return 0;
    }


#include<bits/stdc++.h>
#include<string>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define pb push_back
#define MOD 1000000007
#define MODE 1000000006
#define INF 1000000100
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vl vector<ll>
#define llll pair<ll,ll>
#define vll vector<llll >
#define ii pair<int,int>
#define vii vector< ii >
#define vvi vector< vector<int > >
#define vvii vector< vector<ii > >
#define itr :: iterator it
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << ' '; cout << endl;
#define printii(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << it->first<<' '<<it->second << endl; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
#define LC(i) 2*(i)+1
#define RC(i) 2*(i)+2
#define MID(i,j) ((i)+(j))/2
#define disparr(arr,n) for(int i=0;i<(n);i++)   cout<<arr[i]<<' ';  cout<<endl;
#define vd vector<double>
#define ld long double
#define rep(i,n)  for(int (i)=0;(i)<(n);(i)++)
#define repe(i,n)   for(int (i)=1;(i)<=(n);(i)++)
int main()
{
    string str;
    cin>>str;
    ll ans=1,val=10;
    int zero=0;
    vi taken(15,0);
    int n=str.length();
    for(int i=0;i<n;i++)
    {
        if(str[i]>='0' && str[i]<='9')
            continue;
        else if(str[i]=='?')
        {
            if(i==0)
                ans*=9;
            else
                zero++;
        }
        else
        {
            if(!taken[str[i]-'A'])
            {
                if(i==0)
                    ans*=(val-1);
                else
                    ans*=val;
                val--;
            }
            taken[str[i]-'A']=1;
        }
    }

    cout<<ans;
    for(int j=0;j<zero;j++)
        cout<<0;
}


#include<bits/stdc++.h>
#include<string>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define pb push_back
#define MOD 1000000007
#define MODE 1000000006
#define INF 1000000100
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vl vector<ll>
#define llll pair<ll,ll>
#define vll vector<llll >
#define ii pair<int,int>
#define vii vector< ii >
#define vvi vector< vector<int > >
#define vvii vector< vector<ii > >
#define itr :: iterator it
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << ' '; cout << endl;
#define printii(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << it->first<<' '<<it->second << endl; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
#define LC(i) 2*(i)+1
#define RC(i) 2*(i)+2
#define MID(i,j) ((i)+(j))/2
#define disparr(arr,n) for(int i=0;i<(n);i++)   cout<<arr[i]<<' ';  cout<<endl;
#define vd vector<double>
#define ld long double
#define rep(i,n)  for(int (i)=0;(i)<(n);(i)++)
#define repe(i,n)   for(int (i)=1;(i)<=(n);(i)++)
int main()
{
    string str;
    cin>>str;
    ll ans=1,val=10;
    vi taken(15,0);
    int n=str.length();
    for(int i=0;i<n;i++)
    {
        if(str[i]>='0' && str[i]<='9')
            continue;
        else if(str[i]=='?')
        {
            if(i==0)
                ans*=9;
            else
                ans*=10;
        }
        else
        {
            if(!taken[str[i]-'A'])
            {
                if(i==0)
                    ans*=(val-1);
                else
                    ans*=val;
                val--;
            }
            taken[str[i]-'A']=1;
        }
    }
    cout<<ans;
}


#include<bits/stdc++.h>
#include<string>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define pb push_back
#define MOD 1000000007
#define MODE 1000000006
#define INF 1000000100
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vl vector<ll>
#define llll pair<ll,ll>
#define vll vector<llll >
#define ii pair<int,int>
#define vii vector< ii >
#define vvi vector< vector<int > >
#define vvii vector< vector<ii > >
#define itr :: iterator it
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << ' '; cout << endl;
#define printii(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << it->first<<' '<<it->second << endl; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
#define LC(i) 2*(i)+1
#define RC(i) 2*(i)+2
#define MID(i,j) ((i)+(j))/2
#define disparr(arr,n) for(int i=0;i<(n);i++)   cout<<arr[i]<<' ';  cout<<endl;
#define vd vector<double>
#define ld long double
#define rep(i,n)  for(int (i)=0;(i)<(n);(i)++)
#define repe(i,n)   for(int (i)=1;(i)<=(n);(i)++)
int main()
{
    string str;
    cin>>str;
    ll ans=1,val=10;
    int zero=0;
    vi taken(15,0);
    int n=str.length();
    for(int i=0;i<n;i++)
    {
        if(str[i]>='0' && str[i]<='9')
            continue;
        else if(str[i]=='?')
        {
            if(i==0)
                ans*=9;
            else
                zero++;
        }
        else
        {
            if(!taken[str[i]-'A'])
            {
                if(i==0)
                    ans*=(val-1);
                else
                    ans*=val;
                val--;
            }
            taken[str[i]-'A']=1;
        }
    }

    cout<<ans;
    for(int i=0;i<zero;i++)
        cout<<0;
}


/* -*- coding: utf-8 -*-
 *
 * 0316A2.cc: A2. Special Task
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

char s[MAX_N + 4];
bool used[10];

/* subroutines */

/* main */

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  scanf("%s", s);

  int qn = 0, an = 0;
  for (char *cpt = s; *cpt; cpt++) {
    if (*cpt == '?') qn++;
    else if (*cpt >= 'A' && *cpt <= 'J') {
      int k = *cpt - 'A';
      if (! used[k]) {
	used[k] = true;
	an++;
      }
    }
  }

  int p = 1;
  for (int i = 0; i < an; i++) p *= (10 - i);

  if (*s == '?')
    p *= 9, qn--;
  else if (*s >= 'A' && *s <= 'J')
    p = p / 10 * 9;

  printf("%d", p);
  while (qn--) putchar('0');
  putchar('\n');
  return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,cnt=0;
	long double f=1;
	string s,test="";
	cin>>s;
	n=s.length();
	map<char,ll> r;

	for(i=0;i<n;i++)
	{
		if(s[i]=='?')
		{
			if(i==0)
			{
				f=f*9;
			}
			else
			{
				test+="0";
			}
		}
		else if(s[i]>='A' && s[i]<='J')
		{
			if(r[s[i]]==0)
			{
				f=f*(10-(i==0)-cnt);
				r[s[i]]++;
				cnt++;
			}
		}
	}
	cout<<f<<test;
}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,cnt=0;
	ll f=1;
	string s,test="";
	cin>>s;
	n=s.length();
	map<char,ll> r;

	for(i=0;i<n;i++)
	{
		if(s[i]=='?')
		{
			if(i==0)
			{
				f=f*9;
			}
			else
			{
				test+="0";
			}
		}
		else if(s[i]>='A' && s[i]<='J')
		{
			if(r[s[i]]==0)
			{
				f=f*(10-(i==0)-cnt);
				r[s[i]]++;
				cnt++;
			}
		}
	}
	cout<<f<<test;
}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,f=1,cnt=0;
	string s;
	cin>>s;
	n=s.length();
	map<char,ll> r;

	if(s[0]=='?')
	{
		f=f*9;
	}
	else if(s[0]>='A' && s[0]<='J')
	{
		f=f*(9-cnt);
		r[s[0]]++;
		cnt++;
	}
	else if(s[i]>='0' && s[0]<='9')
	{
		f=f*1;
	}

	for(i=1;i<n;i++)
	{
		if(s[i]=='?')
		{
			f=f*10;
		}
		else if(s[i]>='A' && s[i]<='J')
		{
			if(r[s[i]]==0)
			{
				f=f*(10-cnt);
				r[s[i]]++;
				cnt++;
			}
		}
		else if(s[i]>='0' && s[0]<='9')
		{
			f=f*1;
		}
	}
	cout<<f;
}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,f=1,cnt=0;
	string s;
	cin>>s;
	n=s.length();
	map<char,ll> r;

	for(i=0;i<n;i++)
	{
		if(s[i]=='?')
		{
			f=f*(10-(i==0));
		}
		else if(s[i]>='A' && s[i]<='J')
		{
			if(r[s[i]]==0)
			{
				f=f*(10-(i==0)-cnt);
				r[s[i]]++;
				cnt++;
			}
		}
	}
	cout<<f;
}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,cnt=0;
	long double f=1;
	string s;
	cin>>s;
	n=s.length();
	map<char,ll> r;

	for(i=0;i<n;i++)
	{
		if(s[i]=='?')
		{
			f=f*(10-(i==0));
		}
		else if(s[i]>='A' && s[i]<='J')
		{
			if(r[s[i]]==0)
			{
				f=f*(10-(i==0)-cnt);
				r[s[i]]++;
				cnt++;
			}
		}
	}
	cout<<f;
}


#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t,n,i,cnt=0;
	long double f=1;
	string s;
	string ramu="";
	cin>>s;
	n=s.length();
	map<char,ll> r;

	for(i=0;i<n;i++)
	{
		if(s[i]=='?')
		{
			if(i==0)
			{
				f=f*9;
			}
			else
			{
				ramu+="0";
			}
		}
		else if(s[i]>='A' && s[i]<='J')
		{
			if(r[s[i]]==0)
			{
				f=f*(10-(i==0)-cnt);
				r[s[i]]++;
				cnt++;
			}
		}
	}
	cout<<f<<ramu;
}


#include <bits/stdc++.h>

using namespace std;

int ans = 1, cnt, mult = 10;
string txt;
bool flag, mark[36];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> txt;
	for(int i = 0; i < txt.size(); i++) {
		if(txt[i] == '?')
			((!i) ? ans *= 9 : ans *= 10);
		else if(txt[i] >= 'A' && txt[i] <= 'J' && !mark[txt[i] - 'A']) {
			cnt++, mark[txt[i] - 'A'] = 1;
			if(!i)
				flag = 1;
		}
	}
	for(int i = 0; i < cnt; i++)
		ans *= mult, mult--;
	if(flag == 1)
		ans = (ans / 10) * 9;
	return cout << ans << endl, 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repi(i, a, b) for(int i=(a); i>(b); i--)
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define ll long long
#define gcd __gcd
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)); (v).erase(unique(all(v)), (v).end())
#define pii pair<int, int>
#define vi vector<int>
#define vpii vector<pii>
#define vvi vector<vi>
#define fi first
#define se second
#define pqueue priority_queue
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define PI acos(-1.0)
#define EPS 1e-9
#define mod 1000000007
using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

template<typename T1, typename T2>
ostream& operator << (ostream& os, const pair<T1, T2>& p) { return os << '(' << p.fi << ", " << p.se << ')'; }

template<typename T>
void printv(const T& v) { for(auto i : v) cerr << i << ' '; cerr << '\n'; }

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;

//All indexing is 0-based
using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
//methods: find_by_order(k); & order_of_key(k);
//To make it an ordered_multiset, use pairs of (value, time_of_insertion)
//to distinguish values which are similar

template<class key, class value, class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

//Returns no. of values x for which ceil(n / x) == y (y must be > 1).
inline ll CC(ll n, ll y) { return iceil(n, y-1) - iceil(n, y); }

//Returns no. of values x for which floor(n / x) == y
inline ll FF(ll n, ll y) { return n / y - n / (y+1); }

//a and b are assumed to be taken modulo p
inline int add(int a, int b, int p = mod){ int c = a + b; if(c >= p) c -= p; return c; }
inline int sub(int a, int b, int p = mod){ int c = a - b; if(c < 0) c += p; return c; }
inline int mul(int a, int b, int p = mod){ return (a * 1ll * b) % p; }

#define N 100005
#define int ll
// #define trace(...) 42

int n;
string s;
int ans, qs;

main()
{
    #ifndef ONLINE_JUDGE
        freopen("/home/tarun/Desktop/input.txt", "r", stdin);
     // freopen("/home/tarun/Desktop/output.txt", "w", stdout);
    #endif
    sync;
    clock_t clk = clock();
    cerr << "I will return...\n";

    cin >> s; n = s.sz;
    set<char> vis;
    ans = 1;
    int cur = 10;
    if(s[0] == '?') ans *= 9;
    else if(isalpha(s[0])) ans *= --cur, vis.insert(s[0]);

    rep(i, 1, n) {
        if(s[i] == '?') ++qs;
        else if(isalpha(s[i])) {
            if(vis.count(s[i])) continue;
            vis.insert(s[i]);
            ans *= cur--;
        }
    }

    cout << ans;
    while(qs--) cout << 0; cout << '\n';

    cerr << "...don't you ever hang your head.\n";
    cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / cps << '\n';
}

//Compile using:
//g++ -o filename.exe --std=c++11 filename.cpp
//Use -D CP for defining a macro CP in the local environment


#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
#include <set>
#include <utility>
#include <cstring>
#include <math.h>

using namespace std;

bool comp1(int& a, int& b);
int64_t gcd(int64_t a, int64_t b);
bool comp2 (int& a, int& b);
bool comp3 (pair<int, int>& a, pair<int, int>& b);
bool comp4 (pair<int, int>& a, pair<int, int>& b);
bool isPrime (int& x);

void input (vector<int>& v, int& n) {
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
	}
}

int sum (vector<int>& v) {
	int s = 0;
	for (auto& el : v) {
		s += el;
	}
	return s;
}

int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	int64_t ans = 1;
	set<char> simbols;
	int cntQ = 0;;
	for (size_t i = 0; i < s.size(); ++i) {
		if (s[i] == '?') {
			cntQ++;
		} else if (s[i] >= 'A' && s[i] <= 'J') {
			simbols.insert(s[i]);
		}
	}
	int k = 10;
	int size = simbols.size();
	if (s[0] == '?') {
		ans = 9;
		cntQ--;
	} else if (s[0] >= 'A' && s[0] <= 'J') {
		size --;
		k--;
		ans = 9;
	}
	for (int i = 0; i < size; ++i) {
		ans *= k;
		k--;
	}
	string g;
	while (ans > 0) {
		g += (ans%10 + '0');
		ans /= 10;
	}
	reverse(g.begin(), g.end());
	for (int i = 0; i < cntQ; ++i) {
		g += '0';
	}
	cout << g;
	return 0;
}


#include <iostream>
#include <string>
#include <numeric>

using namespace std;

int main()
{
    string s;
    cin >> s;

    int letter[128] = {0}, zero = 0;
    for (size_t i = 0; i < s.length(); ++i)
    {
        if (s[i] >= 'A' && s[i] < 'K')
        {
            letter[s[i]] = 1;
        }
        else if (s[i] == '?')
        {
            zero += 1;
        }
    }

    int result = 1;
    int lettercount = accumulate(letter + 'A', letter + 'K', 0);
    if (lettercount > 0)
    {
        if (s[0] >= 'A' && s[0] < 'K')
        {
            result *= 9;
        }
        else
        {
            result *= 10;
        }
    }
    for (int i = 1; i < lettercount; ++i)
    {
        result *= (10 - i);
    }

    if (zero > 0 && s[0] == '?')
    {
        result *= 9;
        zero -= 1;
    }

    string padding(zero, '0');
    cout << result << padding << endl;
}


#include<bits/stdc++.h>
#include <initializer_list>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define F first
#define pb push_back
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}

int main(){
    ll mark=0;
    ll k;
    string s;cin>>s;
    ll tp[5000];

    for(ll i=0;i<s.length();i++){
        if(s[i]=='?')mark++;
        else if(s[i]>'0'||s[i]>'9')tp[s[i]]++;
    }
    if(s[0]=='?'){
        mark--;
        k=10;
        ll res=9;
        for(ll i='A';i<='J';i++){
            if(tp[i]){
                res*=k;
                k--;
            }
        }
        cout<<res;
        for(ll i=0;i<mark;i++)
            cout<<0;
    }
    else if(isalpha(s[0])){
        k=10;
       ll res=1;
        for(ll i='A';i<='J';i++){
            if(tp[i]){
                res*=min(k,(ll)9);
                k--;
            }
        }
        cout<<res;
        for(ll i=0;i<mark;i++)
            cout<<0;

    }
    else{
        k=10;
        ll res=1;
        for(ll i='A';i<='J';i++){
            if(tp[i]){
                res*=k;
                k--;
            }
        }
        cout<<res;
        for(ll i=0;i<mark;i++)
            cout<<0;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    string s; cin >> s;
    int chr[10], cnt = 0, cnt_ = 0;
    memset(chr, 0, sizeof(chr));
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '?')
            cnt_++;
        if('A' <= s[i] and s[i] <= 'J')
            chr[(int)s[i]-'A']++;
    }

    for(int i = 0; i < 10; i++)
        cnt += int (chr[i] > 0);
    ll flg = ('A' <= s[0] and s[0] <= 'J') ? 1 : 0;
    ll ans = 1, k = 10;
    while(cnt--)
    {
        ans *= (k-flg);
        flg = 0;
        k--;
    }
    if(s[0] == '?')
    {
        ans *= 9;
        cnt_--;
    }
    cout << ans;
    while(cnt_--)
        cout << 0;
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    string s; cin >> s;
    int chr[10], cnt = 0, cnt_ = 0, cnt0 = 0;
    memset(chr, 0, sizeof(chr));
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '?')
            cnt_++;
        if('A' <= s[i] and s[i] <= 'J')
            chr[(int)s[i]-'A']++;
    }
    for(int i = 0; 'A' <= s[i] and s[i] <= 'J'; i++)
        cnt0++;

    for(int i = 0; i < 10; i++)
        cnt += int (chr[i] > 0);
    ll ans = 1, k = 10, flg = 1;
    while(cnt--)
    {
        flg = cnt0-- > 0 ? 1 : 0;
        ans *= (k-flg);
        k--;
    }
    cout << ans;
    while(cnt_--)
        cout << 0;
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    string s; cin >> s;
    int chr[10], cnt = 0, cnt_ = 0;
    memset(chr, 0, sizeof(chr));
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '?')
            cnt_++;
        if('A' <= s[i] and s[i] <= 'J')
            chr[(int)s[i]-'A']++;
    }

    for(int i = 0; i < 10; i++)
        cnt += int (chr[i] > 0);
    ll flg = ('A' <= s[0] and s[0] <= 'J') ? 1 : 0;
    ll ans = 1, k = 10;
    while(cnt--)
    {
        ans *= (k-flg);
        flg = 0;
        k--;
    }
    cout << ans;
    while(cnt_--)
        cout << 0;
    cout << endl;

    return 0;
}