Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n := io.NextInt()
		if n == 0 {
			break
		}
		k := make([]int, n)
		for i := 0; i < n; i++ {
			k[i] = io.NextInt()
		}
		const st = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
		s := io.NextLine()
		for i, cnt := 0, 0; i < len(s); i, cnt = i+1, (cnt+1)%n {
			idx := strings.IndexRune(st, rune(s[i]))
			c := st[(idx-k[cnt]+52)%52]
			io.Printf("%c", c)
		}
		io.Println()
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 1000000
 
using namespace std;
typedef long long ll;
 



char back(char a,int bnum){
	int lest;
	if('a'<=a && a<='z'){//こもじ
		if(a-bnum>='a'){
			return a-bnum;
		}else{
			lest=(a-'a'+1)-bnum;
			return 'Z'+lest;
		}
	}else if('A'<=a && a<='Z'){//おおもじ
		if(a-bnum>='A'){
			return a-bnum;
		}else{
			lest=(a-'A'+1)-bnum;
			return 'z'+lest;
		}
	}
}

int main(){
	while(1){
	int len;
	int n,k[53],key[101];
	cin>>n;
	if(n==0)break;

	string s;
	for(int i=0;i<n;i++){
		cin>>k[i];
	}
	cin>>s;

	int num=0;
	for(int i=0;i<101;i++){
		key[i]=k[num%(n)];
		num++;
	}
	for(int i=0;i<s.size();i++){
		s[i]=back(s[i],key[i]);
	}
	cout<<s<<endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void Solve(int n){
  std::vector<int> key(n);
  for(int i=0;i<n;i++){
    cin>>key[i];
  }
  std::string s;
  cin>>s;
  std::string result;
  int key_itr=0;
  for(int i=0;i<s.size();i++){
    char target=s[i];
    for(int i=0;i<key[key_itr];i++){
      target--;
      if(target<'A'){
        target='z';
      }
      else if('Z'<target&&target<'a'){
        target='Z';
      }
    }
    result+=target;
    key_itr++;
    if(key_itr>=n){
      key_itr=0;
    }
  }
  cout<<result<<endl;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while(1){
    int n;
    cin>>n;
    if(n==0){
      return 0;
    }else{
      Solve(n);
    }
  }


  return 0;
}

C++: /*
Hokudai Practice Contest 2014
A - King's Inspection

ティツァツ」テヲツウツ陛ッツシツ堙」ツつキテ」ツδ淌」ツδ・テ」ツδャテ」ツδシテ」ツつキテ」ツδァテ」ツδウ
テヲツ崢クテ」ツ?凝」ツつ古」ツ?ヲテ」ツ??」ツつ凝」ツδォテ」ツδシテ」ツδォテ」ツ?ォテ・ツセツ禿」ツ?」テ」ツ?ヲテ・ツセツゥテ・ツ?ε」ツ?凖」ツつ凝」ツ??」ツ?妥」ツ??
テ」ツδォテ」ツδシテ」ツδォテ」ツつ津・ツ?催ァツ渉セテ」ツ?凖」ツつ凝」ツ?淌」ツつ?」ツ?ォテ」ツ?ッテ」ツδェテ」ツつケテ」ツδ暗」ツ?ョテ・ツセツェテァツ陳ーテ」ツつ?ヲツ鳴?・ツュツ療」ツ?ョテ・ツセツェテァツ陳ーテ」ツつ津・ツ?催ァツ渉セテ」ツ?凖」ツつ凝・ツソツ?ィツヲツ?」ツ?古」ツ?づ」ツつ凝」ツ??
(M-1)+1 -> 0, 0-1 -> (M-1)テ」ツ??」ツ?ィテ」ツ?ェテ」ツつ凝」ツつ暗」ツ??」ツ?ォテ」ツ?凖」ツつ凝」ツ?ォテ」ツ?ッテ」ツ??・ツ可ーテ、ツスツ?%)テ」ツつ津ァツ板ィテ」ツ??」ツつ古」ツ?ーテ」ツつ暗」ツ??」ツ??

テヲツ卍づゥツ鳴禿ィツィツ暗ァツョツ療ゥツ?湘ッツシツ唹(|s|)
テァツゥツコテゥツ鳴禿ィツィツ暗ァツョツ療ゥツ?湘ッツシツ唹(n + |s|)
*/

#include<iostream>
#include<cctype>
using namespace std;

//a-zA-z -> テゥツ??ァツ閉ェ
int toInt(char a){
  if(islower(a))return a-'a';
  return a-'A'+26;
}

//テゥツ??ァツ閉ェ -> a-zA-Z
char toChar(int a){
  if(a<26)return 'a'+a;
  return 'A'+a-26;
}

//テゥツァツ?ヲツ閉ー
const int M = 52;

int main(){
  int n,k[100];
  string s;

  while(cin >> n,n){
    for(int i=0;i<n;i++)cin >> k[i];
    cin >> s;

    for(int i=0;i<(int)s.size();i++){
      //テ・ツセツェテァツ陳ーテ」ツつ津」ツつキテ」ツδ淌」ツδ・テ」ツδャテ」ツδシテ」ツつキテ」ツδァテ」ツδウテ」ツ?凖」ツつ凝」ツ?ォテ」ツ?ッmodテ」ツつ津、ツスツソテ」ツ?暗」ツ?ーティツ可ッテ」ツ??
      int tmp = toInt(s[i]) - k[i%n];
      //ティツイツ?ヲツ閉ーテ」ツつづ」ツ?づ」ツつ甘・ツセツ療」ツつ凝・ツ?エテ・ツ青暗」ツ?ョテ・ツョツ嘉・ツ?ィテ」ツ?ェmodテ」ツ?ョテ・ツ渉姪」ツつ甘ヲツ鳴ケテ」ツ?ッ((x%mod) + mod)%mod
      tmp = ((tmp%M) + M) % M;
      cout << toChar(tmp);
    }
    cout << endl;
  }
}

C++: // 2508.cpp
//
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=100;
int k[MAX_N], n;
char a[52];
string s;

void solve(){
  int L=s.length();
  for(int i=0;i<L;++i){
    int x;
    for(int j=0;j<52;++j){
      if(s[i]==a[j]){
        x=j-k[i%n];

        if(x<0) x+=52;
        else if(x>=52) x-=52;

      }
    }
    cout<<a[x];
  }
  cout<<endl;
}
int main() {
  for(int i=0;i<52;++i){
    if(i<26)a[i]='a'+i;
    else a[i]='A'+i-26;
  }

  while(cin>>n,n){
    for(int i=0;i<n;++i)cin>>k[i];
    cin>>s;
    solve();
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
  while(1){
    int n,i,j,key_num,temp;
    vector <int> key;
    vector <char> result;
    string angou;
    string moji="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    
    cin >> n;
    if(n==0)break;
    result.clear();
    key.clear();
    
    for(i = 0; i < n; i++){
      cin >> key_num;
      key.push_back(key_num);
    }
      
    cin >> angou;
    int len = key.size();
    int len2 = angou.size();
    int k = 0; 
    for(i = 0; i < len2; i++){
      for(j = 0; j < 52; j++){
	
	if(moji[j]==angou[i]){
	  result.push_back(moji[j+52-key[k]]);
	  // cout << "moji[j+52]" << moji[j+52] << endl;
	  //cout << "key[k] " << key[k] << endl;
	  //cout << "moji[j+52-key[k]]" << moji[j+52-key[k]] << endl;
	  // cout << "k " << k << endl;
	  k++;
	  if(k==len)k = 0;
	}
      }
    }
    int len3 = result.size();
    for(i = 0; i < len3; i++){
      cout << result[i];
    }
    cout << endl;
  }
  return 0;
}