a = (65..90).map(&:chr) + (97..122).map(&:chr)
loop do
    n = gets.to_i
    break if n == 0
    k = gets.split.map(&:to_i)
    s = gets.strip
    puts s.each_char.map.with_index{|c,i|
        id = a.index(c) - k[i%n]
        id += 52 if id < 0
        a[id]
    }.join
end