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>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

char convert(char c, int f){
  char ret = c;
  while(f--){
    ret--;
    if(ret == 64) ret += 58;
    if(ret == 96) ret -= 6;
  }
  return ret;
}

int main(){
  int n, k, tmp;
  while(scanf("%d", &n) && n){
    queue<int>q;
    char s[128];
    rep(i, n){ scanf("%d", &k); q.push(k);}
    scanf("%s", s);
    rep(i, strlen(s)){
      tmp = q.front();
      s[i] = convert(s[i], tmp);
      q.pop(); q.push(tmp);
    }
    puts(s);
  }
  return 0;
}

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

const vector<char> ss = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','x','y','z',
                         'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','X','Y','Z'};

int main  ()
{
    int n;
    while (cin >> n, n) {
        vector<int> v(n);
        for (auto &i : v) cin >> i;
        string str;
        cin >> str;
        for (int i = 0; i < str.size(); i++) {
            int t = str[i] - (('a' <= str[i] && str[i] <= 'z') ? 'a' : ('A' - 25))  - v[i % n];

            if (t >= 0) {
                cout << ss[t];
            } else {
                cout << ss[ss.size() + t];
            }
        }
        cout << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <string>
using namespace std;


int n;
int key[1000];
string str;

char x[60];

int main(){
  
  while(1){
    cin >> n;
    if(n == 0) break;



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

    cin >> str;
    for(int i = 0,j = 0; i < str.size() ; i++,j++){
      if(i % n == 0) j = 0;
      
      char tmp = str[i] - key[j]; 
   
      if(str[i] - key[j] < 'A' && str[i] <= 'Z' ){
	str[i] += 52 + 6;
      }else  if(str[i] - key[j] < 'A' && str[i] >= 'Z' ){
	str[i] += 52;
      }
      if(str[i] >= 'a' && str[i] - key[j] < 'a') str[i] -= 6;
      str[i] -= key[j];
    }
    cout << str << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    while(cin >> n, n){
        int k[101];
        string s;
        for(int i=0; i < n; i++)
            cin >> k[i];
        cin >> s;

        for(int i=0; i < s.length(); i++){
            for(int j=0; j < k[i%n]; j++){
                if(s[i] == 'A'){
                    s[i] = 'z';
                }else if(s[i] == 'a'){
                    s[i] = 'Z';
                }else{
                    s[i]--;
                }
            }
        }
        cout << s << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

template <class T>
void readVector(int n, vector<T> &v){
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
}

char f(char c, int n){
	if('a' <= c && c <= 'z'){
		if(c - n < 'a'){
			return f('Z', n - c + 'a' - 1);
		}else{
			return c - n;
		}
	}else{
		if(c - n < 'A'){
			return f('z', n - c + 'A' - 1);
		}else{
			return c - n;
		}
	}
}

void solve(int n){
	vector<int> k;
	readVector(n, k);
	string s;
	cin >> s;
	string t = s;
	for(int i=0; i<t.size(); ++i)
		t[i] = f(s[i], k[i%n]);
	cout << t << "\n";
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	while(1){
		int n;
		cin >> n;
		if(n == 0) return 0;
		solve(n);
	}
}