def checkdigit arr
    q = [2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6].reverse
    sum = 0
    arr.zip(q){|x, y| sum += x.to_i * y}
    mn = 11 - (sum % 11)
    mn = 0 if mn >= 10
    mn
end

s = gets.chomp.split("")
idx = s.index("?")
if idx == 11
    mn = checkdigit(s[0, 11])
    puts mn
else
    possible = []
    (0..9).to_a.each{|i|
        s[idx] = i
        mn = checkdigit(s[0, 11])
        possible << i if mn == s[11].to_i
    }
    puts (possible.length == 1 ? possible[0] : "MULTIPLE")
end
