unit = [""] + %w(Man Oku Cho Kei Gai Jo Jou Ko Kan Sei Sai Gok Ggs Asg Nyt Fks Mts)
loop do
    m, n = gets.split.map(&:to_i)
    break if m == 0
    x = m ** n
    s = ""
    unit.size.times do |i|
        y = x % 10000
        s = y.to_s + unit[i] + s if y > 0
        x /= 10000
    end
    puts s
end



