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>
using namespace std;
int main(){
  int n,c=0,k,i;
  string s;
  while(cin>>n,n){
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    cin>>s;
  for(i=0;i<s.size();i++){
    k=a[c++%n];
    if(int(s[i])-k<65)s[i]='{'-k;
    else s[i]=s[i]-k;
  }
  cout<<s<<endl;
  }
}

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

using namespace std;

int main()
{
	const string alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int n;
	while (cin >> n && n != 0)
	{
		vector<int> keys;
		for (int i = 0; i < n; i++)
		{
			int k;
			cin >> k;
			keys.push_back(k);
		}

		char ch[101];
		cin >> ch;
		string crypt = ch;
		vector<char> encrypt;
		for (int i = 0; i < crypt.length(); i++)
		{
			int alphaIndex = alpha.find(crypt.at(i));
			int keyIndex = keys.at(i % keys.size());
			encrypt.push_back(alpha.at((alphaIndex + (alpha.length() - keyIndex)) % alpha.length()));
		}

		for (int i = 0; i < encrypt.size();i++)
		{
			cout << encrypt.at(i);
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cctype>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

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

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

int main(){
  while(const int n = getInt()){
    vector<int> v(n);
    REP(i,n) v[i] = getInt();

    char buff[256];
    scanf("%s", buff);

    for(char *s = buff; *s; s++){
      cout << encode((decode(*s) + 52 - v[(s - buff) % v.size()]) % 52);
    }
    cout << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const double eps=1e-9;
typedef vector<int> vi;
typedef long long ll;
int n;
int key[105];
string station;
string train="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(void)
{
  while(cin >> n&& n)
    {
      for(int i=0;i<n;i++)
	{
	  cin >> key[i];
	}
      cin >> station;
      int ssize=int(station.size());
      for(int i=0;i<ssize;i++)
	{
	  int back=key[i%n];
	  for(int j=0;j<int(train.size());j++)
	    {
	      if(station[i]==train[j])
		{
		  station[i]=train[(j-back+52)%52];
		  break;
		}
	    }
	}
      cout << station << endl;
    }
  return 0;
}

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

#define KEY_NUM 52

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>
#include<map>
#include<string>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef int Def;
typedef vector<Def> vi;
typedef pair<Def,Def> pii;
int main(){
	int n;
	while(cin>>n,n){
		vi in(n);
		rep(i,n)cin>>in[i];
		string s;
		cin>>s;
		rep(i,s.size()){
			int t=in[i%n];
			if(t>=26){
				t-=26;
				if(islower(s[i]))s[i]+=26;
				else s[i]-=26;
			}
			if(islower(s[i])){
				s[i]-=t;
				if(s[i]<'a')s[i]='Z'-('a'-s[i])+1;
			}else{
				s[i]-=t;
				if(s[i]<'A')s[i]='z'-('A'-s[i])+1;
			}
		}
		cout<<s<<endl;
	}
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	int n;
	cin>> n;
	if(!n) return false;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>> a[i];
	}
	string str;
	cin>> str;
	
	for(int i=0;i<str.size();i++){
		int k = a[i%n];
		k %= 52;
		char c = str[i];
		if(k>26){
			if(islower(c)){
				c = toupper(c);
			}else{
				c = tolower(c);
			}
			k -= 26;
		}
		if(islower(c)){
			if(islower(c-k)){
				c -= k;
			}else{
				k -= c - 'a';
				c = 'Z' - (k - 1);
			}
		}else if(isupper(c)){
			if(isupper(c-k)){
				c -= k;
			}else{
				k -= c - 'A';
				c = 'z' - (k - 1);
			}
		}
		cout<< c;
	}
	cout<< endl;

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	while(solve()){}

	return 0;
}