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>
using namespace std;

int main() {
	int n;
	while(cin >> n && n){
		int k[101] = {0};
		for(int i = 0; i < n; ++i){
			cin >> k[i];
		}
		char s[128];
		scanf("%s", s);
		for(int i = 0; i < strlen(s); ++i){
			if(s[i] - k[i % n] <= 64 && s[i] <= 90){
				s[i] = s[i] - k[i % n] + 52;
				if(s[i] > 90)
					s[i] += 6;
			}
			else if(70 < s[i] - k[i % n] && s[i] - k[i % n] < 97 && s[i] >= 97){
				s[i] = s[i] - k[i % n] - 6;
			}
			else if(s[i] >= 97 && s[i] - k[i % n] <= 70){
				s[i] = 52 + s[i] - k[i % n];
			}
			else{
				s[i] -= k[i % n];
			}
		}
		printf("%s\n", s);
	}
	/*printf("%d\n", 'A');
	printf("%d\n", 'Z');
	printf("%d\n", 'a');
	printf("%d\n", 'z');
	printf("%d\n", '@');*/
	return 0;
}

C++: #define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return;
		vector<int> keys;
		REP(i, n) {
			int ans = 0;
			cin >> ans;
			keys.push_back(ans);
		}
		string s;
		cin >> s;
		REP(i, s.length()) {
			REP(q, keys[i % keys.size()]) {
				if (s[i] == 'a') s[i] = 'Z';
				else if (s[i] == 'A') s[i] = 'z';
				else s[i]--;
			}
		}
		cout << s << endl;
	}
}
#undef int

int main() {
	init();
	solve();
}

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

using namespace std;

int main()
{
	int N;
	vector<char> sig;
	
	for (int i=0; i<26; i++) sig.push_back((char)('a'+i));
	for (int i=0; i<26; i++) sig.push_back((char)('A'+i));
	

	while (cin>>N, N) {
		vector<int> list(N);
		string S;
		
		for (int i=0; i<N; i++) {
			cin>>list[i];
		}
		
		cin>>S;
		
		for (int i=0; i<S.size(); i++) {
			int t = find(sig.begin(), sig.end(), S[i])-sig.begin();
			int key = list[i%list.size()];
			
			cout << sig[(t-key+52)%52];
		}
		cout << endl;
	}
}

C++: #include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

int main() {
  int n, tmp;
  string s, res, station = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  while (cin >> n, n) {
    int key[n];
    for (int i = 0; i < n; i++) {
      cin >> tmp;
      key[i] = tmp;
    }
    cin >> s;
    res = "";
    for (int i = 0; i < s.length(); i++) {
      res += station[(station.find(s[i])-key[i%n]+52)%52];
    }
    cout << res << el;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

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

char solve(char c, int key){
  while(key--){
    if(c == 'A') c = 'z';
    else if(c == 'a') c = 'Z';
    else c--;
  }
  return c;
}

int main(){
  int n;
  while(cin >> n, n){
    vector<int> key(n);
    rep(i, n) cin >> key[i];
    
    string str;
    cin >> str;
    rep(i, str.size()){
      cout << solve(str[i], key[i%n]);
    }
    cout << endl;
  }
  return 0;
}

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

int n;
int key[100];
string s;
string eki;

int toIndex(char c) {
	if (c >= 'a') return c - 'a';
	return c - 'A' + 26;
}

int main() {
	int i;
	
	for (i = 0; i < 26; i++) eki += 'a' + i;
	for (i = 0; i < 26; i++) eki += 'A' + i;
	
	while (cin >> n) {
		if (!n) break;
		for (i = 0; i < n; i++) cin >> key[i];
		cin >> s;
		
		for (i = 0; i < s.length(); i++) {
			int k = key[i % n];
			cout << eki[(toIndex(s[i]) - k + 52) % 52];
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
  while(1){
    int n;
    cin>>n;
    int a;
    if(n==0)break;
    vector<int> k(n);
    string s;
    for(int i=0;i<n;i++)cin>>k[i];
    cin>>s;
    for(int i=0;i<s.size();i++){
      if(k[i%n]<=26){
        a=s[i]-k[i%n];
        if(a<'A'&&s[i]>='A'&&s[i]<='Z'){
           a+='z'-'A'+1;
         }else if(a<'a'&&s[i]>='a'&&s[i]<='z')a-='a'-'Z'-1;
      }else{
        a=s[i]+(52-k[i%n]);
        if(a>'z'&&s[i]>='z'&&s[i]>='a'){
          a-='z'-'A'+1;
        }else if(a>'Z'&&s[i]<='Z'&&s[i]>='A')a+='a'-'Z'-1;
      }
      putchar(a);
    }
    cout<<endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

  int n;

  while(cin>>n,n){

	vector<int> k(n);
	string s;

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

	cin>>s;

	int key=0;
	
	for(int i=0;i!=s.size();++i){
	  for(int j=0;j<k[key];++j){
		if(s[i]=='a')
		  s[i]='Z';
		else  if(s[i]=='A')
		  s[i]='z';
		else
		  s[i]--;
	  }
	  if(key==n-1)
		key=0;
	  else
		key++;
	}

	cout<<s<<endl;
	
  }

}