def calc_check_digit(my_number)
  q = [0,2,3,4,5,6,7,2,3,4,5,6]
  sum=0
  (1..11).each do |i|
    sum += my_number[i].to_i * q[i]
  end
  mod = sum % 11
  if mod <= 1 then
    return 0 
  else
    return 11 - mod
  end
end

my_number = STDIN.gets.chomp.reverse

if my_number.index('?') == 0 then
  puts calc_check_digit(my_number)
else
  check_digit = my_number[0].to_i
  possible_numbers = []
  (0..9).each do |i|
    tmp = my_number.gsub(/\?/, i.to_s)
    if check_digit == calc_check_digit(tmp) then
      possible_numbers.push(i)
    end
  end 
  if possible_numbers.length > 1 then
    puts 'MULTIPLE'
  else
    puts possible_numbers[0]
  end
end