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;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int main(){
    cin.sync_with_stdio(false);
    int n;
    while(cin >> n, n) {
        int key[n];
        rep(i, n) cin >> key[i];
        string s;
        cin >> s;
        int i = 0;
        rep(j, s.size()) {
            if ('a' <= s[j] && s[j] <= 'z') {
                if (key[i] <= 26) {
                    if (s[j] - 'a' >= key[i]) s[j] = (char)(s[j] - key[i]);
                    else s[j] = (char)('Z' - (key[i] - (s[j] - 'a') - 1));
                } else {
                    s[j] = (char)(s[j] + ('A' - 'a'));
                    if (s[j] - 'A' >= key[i] - 26) s[j] = (char)(s[j] - key[i] + 26);
                    else s[j] = (char)('z' - (key[i] - (s[j] - 'A') - 27));
                }
                i = (i + 1) % n;
            } else {
                if (key[i] <= 26) {
                    if (s[j] - 'A' >= key[i]) s[j] = (char)(s[j] - key[i]);
                    else s[j] = (char)('z' - (key[i] - (s[j] - 'A') - 1));
                } else {
                    s[j] = (char)(s[j] - ('A' - 'a'));
                    if (s[j] - 'a' >= key[i] - 26) s[j] = (char)(s[j] - key[i] + 26);
                    else s[j] = (char)('Z' - (key[i] - (s[j] - 'a') - 27));
                }
                i = (i + 1) % n;
            }
        }
        cout << s << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) c.begin(),c.end()
int I(char c){
	if(islower(c)) return c-'a';
	return c-'A'+26;
}
char C(int x){
	if(x<26) return x+'a';
	return x-26+'A';
}
int main(){
	while(true){
		int n,a[100];
		cin>>n;
		if(n==0) break;
		rep(i,n) cin>>a[i];
		string s;
		cin>>s;
		rep(i,s.size()){
			s[i]=C( (I(s[i])+52-a[i%n])%52);
		}
		cout<<s<<endl;
	}
}

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

string station = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int search(char c){
  for(int i = 0; i < 52; i++){
    if(station[i] == c) return i;
  }
  return -1;
}

int main(void){
  int n;
  while(cin >> n && n != 0){
    int key[100];
    for(int i = 0; i < n; i++) cin >> key[i];
    string ms;
    cin >> ms;
    for(int i = 0; i < ms.size(); i++){
      int index = search(ms[i]);
      index = (index - key[i % n]) % 52;
      if(index < 0) index += 52;
      ms[i] = station[index];
    }
    cout << ms << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const string stations = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main(){

  int n;
  while(~scanf("%d",&n)){
    if(n==0) break;

    int back_dist[101];
    for(int i=0;i<n;i++){
      scanf("%d",back_dist+i);
    }
    string str;
    cin >> str;

    int back_idx = 0;
    for(int i=0;i<str.size();i++){
      int pos = lower_bound(stations.begin(),stations.end(),str[i]) - stations.begin();
      str[i] = stations[(pos - back_dist[back_idx] + stations.size()) % stations.size()];
      back_idx++;
      back_idx %= n;
    }

    cout << str << endl;
  }
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

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

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

char mozi[53];
int main(){
	while(1){
		int n;
		int ikey[110] = {0};
		cin>>n;
		if(n==0)break;
		rep(i,n){
			cin>>ikey[i];
		}
		int tmp=0;
		rep(i,52){
			if(i==26) tmp+=6;
			mozi[i]='A'+i+tmp;
			// cout<<mozi[i];
		}
		string skey;
		vi spos;
		cin>>skey;
		string ans = "";
		rep(i,skey.size()){
			spos.pb(int(char(skey[i])-'A'));
			if(char(skey[i])>='a'){
				spos[i]-=6;
			}
			ans += mozi[(spos[i]-ikey[i%n]+52)%52];
		}
		cout<<ans<<endl;

	}
	return 0;
}