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++: // AOJ 2508
#include<iostream>
#include<string>
#include<cctype>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int n;
int k[100];
std::string s;

char step( int i )
{
	bool fl = isupper(s[i]);
	int t = s[i]-(fl?'A':'a')-k[i%n];

	if( t < 0 )
		fl ^= true, t += 26;

	return t+(fl?'A':'a');
}

int main()
{
	while( std::cin >> n, n )
	{
		rep( i, n )
			std::cin >> k[i];
		std::cin >> s;

		rep( i, s.size() )
			std::cout << step(i);

		std::cout << std::endl;
	}

	return 0;
}

C++: #include<iostream>
#include<strstream>
#include<stack>
#include<utility>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<climits>
#include<map>
#include<string>
#include<sstream>

using namespace std;

#define mp make_pair
#define rep(i,n) for( int i = 0; i < n; i++ )
typedef long long int ll;

int main()
{
	int n;
	while( cin >> n, n )
	{
		vector<int> v(n);
		rep(i,n)
		{
			cin >> v[i];
		}
		string s;
		cin >> s;

		for( int i = 0, v_i = 0; i < s.size(); i++, v_i++ )
		{
			if( v_i > n-1 ){
				v_i = 0;
			}
			rep(j,v[v_i])
			{
				s[i]--;
				if( s[i] == 64 ){
					s[i] = 'z';
				}
				if( s[i] == 96 ){
					s[i] = 'Z';
				}
			}
		}
		cout << s << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n;
int k[102];
string s;
char prev(char c, int m) {
    rep(i, m) {
        if (c == 'a')
            c = 'Z';
        else if (c == 'A')
            c = 'z';
        else
            c--;
    }
    return c;
}
void solve() {
    int idx = 0;
    string ans;
    rep(i, s.size()) {
        char c = prev(s[i], k[idx]);
        ans += c;
        idx++;
        idx %= n;
    }
    cout << ans << endl;
}
int main() {
    while (cin >> n, n) {
        rep(i, n) cin >> k[i];
        cin >> s;
        solve();
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
const int INF = 1<<28;
const string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main() {
	int n;
	while(cin >> n, n) {
		int k[n];
		REP(i, n) cin >> k[i];
		string s; cin >> s;
		int k2[s.size()];
		REP(i, s.size()) {
			size_t p = al.find(s[i]);
			k2[i] = (int)p;
		}
		REP(i, s.size())
			cout << al[(k2[i] - k[i%n] + 52) % 52];
		cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1e9;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */

/** Problem2508 : King's Inspection **/
int main()
{
	int N;
	while (cin>>N, N) {
		vector<int> key(N);
		rep(i, N) cin>>key[i];
		string s; cin>>s;
		
		rep(i, s.size()) {
			char c = s[i];
			for (int j=0; j<key[i%key.size()]; j++) {
				if (c=='a') c='Z';
				else if (c=='A') c='z';
				else c--;
			}
			cout << c;
		}
		cout << endl;
	}
}

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

const string a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    for (int n; cin >> n, n;) {
        vector<int> k(n);
        for (int& e : k) cin >> e;
        string s, t = ""; cin >> s;
        rep(i, s.size()) {
            t += a[(s[i] - (s[i] < 'a' ? 'A' - 26 : 'a') + 52 - k[i % n]) % 52];
        }
        cout << t << endl;
    }
}