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 <iostream>
#include <cstdlib>
#include <string>
using namespace std;
#define N 100

int main(){
        int i=0, key[N], count=0;
        char keymoji;

        cin >> i;
        while(i != 0){
                for(int j=0; j<i; j++){
                        cin >> keymoji;
                        key[j] = keymoji-'0';
                }
                //for(int j=0; j<i; j++){
                //      key[j] = keymoji[j*2]-'0';
                //}
                string eki;
                cin >> eki;
                for(int j=0; j<eki.size(); j++){
                        if(eki[j] <= 'Z'){
                                eki[j] -= key[j%i];
                                if(eki[j] < 'A'){
                                        eki[j] = 'z'+1-('A'-eki[j]);
                                        if(eki[j] < 'a'){
                                                eki[j] = 'Z'+1-('a'-eki[j]);
                                        }
                                }
                        }else{
                                if(eki[j]-key[j%i] < 'a'){
                                        eki[j] -= key[j%i]+('a'-'Z'-1);
                                        if(eki[j] < 'A'){
                                                eki[j] += 'z'-'A'+1;
                                        }
                                }else{
                                        eki[j] -= key[j%i];
                                }
                        }
                }
                cout << eki << endl;
                cin >> i;
        }


}

C++: #include <bits/stdc++.h>
using namespace std;

vector<int> keys;

int main(){
while(1){//start

	//init
	keys.clear();

	int n;
	cin >> n;
	if(n == 0) break;
	for(int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		keys.push_back(temp);
	}

	//extend keys
	for(int i = 0; i < 200; i++){
		int temp = keys[i];
		keys.push_back(temp);
	}

	string s;
	cin >> s;
	for(int i = 0; i < (int)s.size(); i++){
			char c;
			if(islower(s[i])){
				int dist = s[i] - 'a';
				if(dist - keys[i] < 0){
					keys[i] -= dist;
					if(keys[i] >= 26){
						keys[i] -= 26;
						c = 'z' - keys[i] + 1;
						cout << c;
					}
					else{
						c = 'Z' - keys[i] + 1;
						cout << c;
					}
				}
				else{
					c = s[i] - keys[i];
					cout << c;
				}
			}

			else if(isupper(s[i])){
				int dist = s[i] - 'A';
				if(dist - keys[i] < 0){
					keys[i] -= dist;
					if(keys[i] >= 26){
						keys[i] -= 26;
						c = 'Z' - keys[i] + 1;
						//cout << "test3" << endl;
						cout << c;
					}
					else{
						c = 'z' - keys[i] + 1;
						//cout << "test2" << endl;
						cout << c;
					}
				}
				else{
					c = s[i] - keys[i];
					//cout << "test1" << endl;
					cout << c;
				}
			}
	}
	cout << endl;

}//end

	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int k[101];
char s[101];
int main() {
	vector<char>v;
	for (char c = 'a'; c <= 'z'; c++)v.push_back(c);
	for (char c = 'A'; c <= 'Z'; c++)v.push_back(c);
	int n;
	while (scanf("%d", &n), n) {
		rep(i, n)scanf("%d", &k[i]);
		scanf("%s", s);
		int len = strlen(s);
		rep(i, len) {
			s[i] = v[(find(v.begin(), v.end(), s[i]) - v.begin() + 52 - k[i%n]) % 52];
		}
		puts(s);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#include <iostream>

int main(){
  int n;
  string st = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  cin >>n;

  while(n!=0){
    string s;
    vector<int>key;
    string ans = "";

    for(int i = 0; i<n;i++){
      int x;
      cin >>x;
      key.push_back(x);
    }
    cin >>s;
    int ind = 0;
    for (int i = 0; i<(int)s.size(); i++){
      char c;
      for (int j = 0; j < (int)st.size();j++){
        if(s[i] == st[j]){
          if(j - key[ind] < 0)c = st[j - key[ind] + 52];
          else c =  st[j - key[ind]];
        }
      }
      ans = ans + c;
      ind++;
      if(ind >= (int)key.size()){
        ind = 0;
      }
    }
    cout <<ans<<endl;
    key.clear();
    cin >>n;
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    int a[n];
    rep (i, n) cin >> a[i];
    string str;
    cin >> str;
    rep (i, str.size()) {
      int aa = a[i % n];
      while (aa) {
	--aa;
	if (str[i] == 'A') str[i] = 'z';
	else if (str[i] == 'a') str[i] = 'Z';
	else --str[i];
      }
    }
    cout << str << endl;
  }
}