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 REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
using namespace std;
 
int main(){
  while(true){
    int n;
    cin >> n;
    if(!n)break;
    vector<int> line(n);
    REP(i,n){
      int tmp;
      cin >> tmp;
      line[i] = tmp;
    }
    string s;
    cin >> s;
    int line_i;
    REP(i,s.size()){
       
      if(i >= n)line_i = i % n;
      else line_i = i;
      if(s[i] - line[line_i] - 'a' < -26 && s[i] >= 'a')
    s[i] = 'z' + 1 + (s[i] - line[line_i] + 26 - 'a');
      else if(s[i] - line[line_i] - 'A' < -26 && s[i] >= 'A'){
    s[i] = 'Z' + 1 +  (s[i] - line[line_i] + 26 - 'A');
      }else if(s[i] - line[line_i]  < 'a' && s[i] >= 'a'){
    s[i] = 'Z' + 1 + (s[i] -line[line_i] - 'a');
      }else if(s[i] - line[line_i] < 'A' && s[i] >='A'){
    s[i] = 'z' + 1  + (s[i] - line[line_i] - 'A');
      }else{
    s[i] = s[i] - line[line_i];
      }
    }
     
    cout << s <<endl;
  }
 
  return 0;
}

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 (s[j] - 'a' >= key[i]) s[j] = (char)(s[j] - key[i]);
                else s[j] = (char)('Z' - (key[i] - (s[j] - 'a') - 1));
                i = (i + 1) % n;
            } else {
                if (s[j] - 'A' >= key[i]) s[j] = (char)(s[j] - key[i]);
                else s[j] = (char)('z' - (key[i] - (s[j] - 'A') - 1));
                i = (i + 1) % n;
            }
        }
        cout << s << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;

int main()
{
	int n;
	int k[100];
	char s[101];
	while(cin >> n && n != 0){
		int c = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> k[i];
		}
		k[n] = '\0';
		cin >> s;
		for (int i = 0; s[i] != '\0'; ++i)
		{
			if ((char)(s[i] - k[c]) >= 'a' && (char)(s[i] - k[c]) <= 'z')
			{
				cout <<(char)(s[i] - k[c]);
			}else if ((char)(s[i] - k[c]) >= 'A' && (char)(s[i] - k[c]) <= 'Z')
			{
				cout << (char)(s[i] - k[c]);
			}else if((char)(s[i] - k[c]) < 'A' && s[i] <= 'Z'){
				if((char)('z' - (k[c] - (s[i] - 'A'))) + 1 < 'a'){
					cout << (char)('Z' - (k[c] - (s[i] - 'A') - 27)); 
				}else{
					cout << (char)('z' - (k[c] - (s[i] - 'A')) + 1);
				}
			}else{
				if('Z' - (k[c] - (s[i] - 'a')) + 1 < 'A'){
					cout <<(char)('z' - (k[c] - (s[i] - 'a') - 27));
				}else{
					cout << (char)('Z' - (k[c] - (s[i] - 'a')) + 1);
				}
			}
			c++;
			if (k[c] == '\0')
			{
				c = 0;
			}
		}
		cout << endl;
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <set>
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
#define FILL(v, value) (v+(sizeof(v) / sizeof *(v)), value);
#define inf 999999999
#define dbg(x) cout<<#x<<":"<<x<<endl;
#define pb(a) push_back((a))
#define mp(a) make_pair((a))
#define sz(x) (int)(x).size()
#define pi 2*acos(0.0)
#define in scanf
#define out printf
#define fi first
#define se second
#define bit(n) (1LL<<(n))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

const int MOD=1000000007; // 10^9 + 7
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};  // right, down, left, up

string moji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int main(int argc, char**argv){
	int n;
	while(1){
		cin >> n;
		if (n == 0) break;
		vi k;
		rep(i, n){
			int tmp;
			cin >> tmp;
			k.pb(tmp);
		}
		string s;
		cin >> s;

		rep(i, sz(s)){
			int ix = moji.find(s[i]);
			dbg((ix - k[i % sz(k)]) % sz(moji));
			s[i] = moji[(ix - k[i % sz(k)] + sz(moji)) % sz(moji)];
		}
		cout << s << endl;

	}

	return 0;
}