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

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;
/* c++11
#include <tuple>
using std::tuple; 
using std::make_tuple;
using std::get; // tuple std::get<NUM>(t); (0 <= NUM <= 2)
 */

typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

VC make_alphabet_list() {
    VC ret(52);
    for (int i = 0; i < 26; i++) {
        ret[i] = (char)('a' + i);
        ret[i + 26] = (char)('A' + i);
    }
    return ret;
}

VI recreate(VI k, int length) {
    VI use(length);
    int base = (int)(k.size());
    for (int i = 0; i < length; i++) {
        use[i] = k[i % base];
    }
    return use;
}

int main(void) {
    VC alphabet = make_alphabet_list();
    while (1) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        VI k(n);
        for (int i = 0; i < n; i++) {
            cin >> k[i];
        }
        string s;
        cin >> s;
        int length = s.length(); 
        VI s_temp(length);
        VI use_v = recreate(k, length);

        for (int i = 0; i < length; i++) {
            if (s[i] >= 'a' && s[i] <= 'z') {
                s_temp[i] = (int)(s[i] - 'a') + 52;
            } else if (s[i] >= 'A' && s[i] <= 'Z') {
                s_temp[i] = (int)(s[i] - 'A') + 26 + 52;
            }
        }
        s = "";
        for (int i = 0; i < length; i++) {
            s_temp[i] = (s_temp[i]- use_v[i]) % 52;
            s += alphabet[s_temp[i]];
        }
        cout << s << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    while (true){
        string a="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int n;
        cin >> n;
        if (n==0) break;
        vector<int> k(n);
        for (int i=0;i<n;i++){
            cin >> k.at(i);
        }
        string s,b="";
        cin >> s;
        int u=0,p=0;
        for (int i=0;i<s.size();i++){
            for (int I=0;I<52;I++){
                if (s.at(i)==a.at(I)) p=I-k.at(u%n);
            }
            if (p<0) p=p+52;
            b.push_back(a.at(p));
            u++;
        }
        cout << b << endl;
    }
}

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

using namespace std;

int main(){
	int n;
	while(cin >> n, n){
		int num[100];
		string input;

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

		cin >> input;

		for(int i=0; i < input.size(); i++){
			if('a' <= input[i] && input[i] <= 'z'){

				if(input[i]-num[i%n] < 'a') input[i] = 'Z' - ('a' - input[i]+num[i%n]-1);
				else input[i] -= num[i%n];
			}
			else {
				if(input[i]-num[i%n] < 'A') input[i] = 'z' - ('A' - input[i]+num[i%n]-1);
				else input[i] -= num[i%n];
			}
		}
		cout << input << endl;
	}
}

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;
}