#include <iostream>
using namespace std;

string tmp;
int main(){
  cin >> tmp;
  int index = 0;

  for (int i = 0; i < tmp.size(); i++){
    if (tmp[i] == '?'){
      index = i;
      break;
    }
  }

  int count = 0;
  int ans = 0;
  
  for (int i = 0; i < 10; i++){
    string str = tmp;
    str[index] = i + '0';
    
    int Q = 0;
    
    for (int j = 0; j < str.size() - 1; j++){
      const int ind = 11 - j;

      if(ind <= 6){
	Q += (ind + 1) * (str[j] - '0');
	Q %= 11;
      }else{
	Q += (ind - 5) * (str[j] - '0');
	Q %= 11;
      }
    }

    if(Q > 1){
      Q = 11 - Q;
    }else{
      Q = 0;
    }

    // cout << i << " " << str[11] << " " << Q << endl;
    if(str[11] == (Q + '0')){
      count++;
      ans = i;
    }
  }

  if(count > 1){
    cout << "MULTIPLE" << endl;
  }else{
    cout << ans << endl;
  }
}