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 <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
	int n;
	while (cin >> n, n) {
		vector <int> k(n);
		rep (i, n) cin >> k[i];
		string s;
		cin >> s;
		string out = "";

		//A = 65, Z = 90, a = 97
		rep (i, s.size()) {
			out.push_back(s[i] - k[i % n]);
			if ('a' <= s[i] && s[i] <= 'z' && 'A' <= out[i] && out[i] < 'a')
				out[i] -= 'a' - 'Z' - 1;
			if (out[i] < 65)
				out[i] = 'z' - (65 - out[i]) + 1;
		}
		cout << out << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

vector<char> init(){
  vector<char> data;
  for(int c='a'; c<='z'; ++c) data.push_back(c);
  for(int c='A'; c<='Z'; ++c) data.push_back(c);
  return data;
}

char solve(const char& c, int& x, const vector<char>& data){
  for(int i=0; i<data.size(); ++i){
    if(data[i] == c){
      int j = i-x;
      if(j < 0) j += data.size();
      return data[j];
    }
  }
}

int main(){
  int n;
  string s;
  vector<char> s_name = init();
  while(1){
    cin >> n;
    if(!n) break;
    vector<int> data(n, 0);
    for(int i=0; i<n; ++i) cin >> data[i];
    cin >> s;
    for(int i=0, j=0; i<s.size(); ++i){
      cout << solve(s[i], data[j], s_name);
      ++j;
      if(j == data.size()) j=0;
    }
    cout << endl;
  }
  return 0;
}

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

string station = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  int n;
  while(cin >> n, n){;
    vector<int> k(n);
    for(int i = 0; i < n; i++) cin >> k[i];
    string s;
    cin >> s;
    string ans = "";
    for(int i = 0; i < s.size(); i++){
      int prev = k[i % k.size()];
      int idx;
      for(int j = 0; j < station.size(); j++){
        if(station[j] == s[i]){
          idx = j;
          break;
        }
      }
      ans += station[(idx - prev + 52) % 52];
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
char str[110];
int b[110];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++)scanf("%d",b+i);
		scanf("%s",str);
		for(int i=0;str[i];i++){
			int p=0;
			if('a'<=str[i]&&str[i]<='z')p=str[i]-'a';
			else p=str[i]-'A'+26;
			p-=b[i%a];
			if(p<0)p+=52;
			if(p<26)str[i]='a'+p;
			else str[i]='A'+p-26;
		}
		printf("%s\n",str);
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int getIndex(char c) {
    if (islower(c)) return c - 'a';
    return 26 + (c - 'A');
}

char getChar(int index) {
    if (index < 26) return char('a' + index);
    return char('A' + (index - 26));
}

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> k(n);
        for (int i=0; i<n; ++i) cin >> k[i];
        string s;
        cin >> s;
        int j = 0;
        for (int i=0; i<(int)s.size(); ++i) {
            s[i] = getChar((getIndex(s[i]) - k[j] + 52) % 52);
            j = (j + 1) % n;
        }
        cout << s << endl;
    }
    return 0;
}

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

#define KEY_NUM 100

char process_key(char c, int key) {
    
    int num=0;
    //cout << "[" << c << "," << key << "," << num << "]";
    if ('a' <= c && c <= 'z') {
        num = 25 - (int)('z' - c);
    }
    if ('A' <= c && c <= 'Z') {
        num = 51 - (int)('Z' - c);
    }
    num = (num - key) % 52;
    if ( 0 <= num && num <= 25) {
        c = 'a' + num;
    }
    if (26 <= num && num <= 51) {
        c = 'A' + (num - 26);
    }
    //cout << "[" << c << "," << key << "," << num << "]";
    return c;
}

int main(void) {
    string s;
    int n;
    int keys[KEY_NUM];
    while (cin >> n, n) {
        for (int i=0; i<n; i++) {
            cin >> keys[i];
        }
        cin >> s;
        //cout << n << endl;
        for (int i=0; i<s.size(); i++) {
            //cout << process_key(s[i], keys[i % n]) << "_";
            cout << process_key(s[i], keys[i % n]);
        }
        //cout << s << endl;
        cout << endl;
    }
}

C++: #include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N, K[100];
string S;

int main(void) {
  while(cin >> N, N) {
    REP(i, 0, N) cin >> K[i];
    cin >> S;

    string ans = "";
    REP(i, 0, S.length()) {
      char c = S[i];
      if('a' <= c && c <= 'z') {
        c = S[i] - K[i % N];
        if(c < 'a') c = 'Z' + 1 + (c - 'a');
      } else {
        c = S[i] - K[i % N];
        if(c < 'A') c = 'z' + 1 + (c - 'A');
      }
      ans += c;
    }
    cout << ans << endl;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

char change(char c, int n){
    int tmp = 0;
    if('a' <= c && c <= 'z'){
        tmp = c - 'a';
    }else{
        tmp = 26 + c - 'A'; 
    }
    tmp = (tmp - n + 52) % 52;
    if(0 <= tmp && tmp < 26) return 'a' + tmp;
    return 'A' + tmp - 26;
}

signed main(){
    int n;
    while(1){
        cin >> n;
        if(n == 0) break;
        vector<int> k(n);
        rep(i, 0, n) cin >> k[i];
        string s, t = "";
        cin >> s;
        rep(i, 0, s.size()){
            int id = i % n;
            t += change(s[i], k[id]);
        }
        cout << t << endl;
    }
}