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<string>
using namespace std;

char list[52];

char Decoding(char c,int key){
  
  int num;
  
  if(c >= 'A' && c <= 'Z'){
    num=c-65;
  }else{
    num=c-71;
  }

  num=(num+51*key)%52;
  
  return list[num];
  
}
int main(){

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

  for(int i=0 ; i+65 <= 90 ; i++)list[i]=i+65;
  for(int j=0 ; j+97 <= 122 ; j++)list[j+26]=j+97;

  while(1){
    
    cin >>n;
    if(n == 0)break;
    
    for(int i=0 ; i < n ; i++)cin >>key[i];
    
    cin >>str;
    
    for(int i=0 ; i < str.size() ; i++){
      cout <<Decoding(str[i],key[i%n]);
    }
    
    cout <<endl;
    
  }
  
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>

using namespace std;

int main()
{
    int n, i;
    int key[52];
    string s;
    char ans[100];


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

        for(i = 0; i < n; i++){
            cin >> key[i];
        }
        cin >> s;

        for(i = 0; i < s.size(); i++){
            if(s[i] >= 'a' && s[i] <= 'z'){
                int num = key[i % n] - (s[i] - 'a');
                if(num > 0){
                    ans[i] = 'Z' - num;
                } else {
                    ans[i] = s[i] - key[i % n];
                }
            } else {
                int num = key[i % n] - (s[i] - 'A');
                if(num > 0){
                    ans[i] = 'z' - num;
                } else {
                    ans[i] = s[i] - key[i % n];
                }
            }
        }
        ans[s.size()] = '\0';

        cout << ans << endl;
    }

    return 0;
}

C++: #include <iostream>
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

using namespace std;

int main(){
	int n;
	string s;
	string alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ans;
	while(1){
		cin >> n;
		if(n == 0) break;
		int k[n];
		for(int i = 0; i < n; i++){
			cin >> k[i];
		}
		cin >> s;
		for(int i = 0; i < s.length(); i++){
			int kn = i%ARRAY_LENGTH(k);
			int alpn = alp.find(s[i])-k[kn];
			if(alpn < 0) alpn += 52;
			else if(alpn > 52) alpn -=52;
			cout << alp[alpn];
		}
		cout << endl;
	}
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

char cc(char x) {
    if (x == 'a') return 'Z';
    if (x == 'A') return 'z';
    return --x;
}

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    cin >> skipws;

    for (;;) {
        int n; cin >> n;
        if (!n) break;
        vector<int> v(n);
        rep(i, 0, n) cin >> v[i];
        string s; cin >> s;
        rep(i, 0, s.length()) {
            rep(j, 0, v[i % n]) s[i] = cc(s[i]);
        }
        cout << s << endl;
    }
}

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

int main() {
	int n;
	while(cin >> n && n){
		int k[101] = {0};
		for(int i = 0; i < n; ++i){
			cin >> k[i];
		}
		char s[128];
		scanf("%s", s);
		for(int i = 0; i < strlen(s); ++i){
			if(k[i % n]){
				if(s[i] - k[i % n] <= 64 && s[i] <= 90){
					s[i] = s[i] - k[i % n] + 58;
					if(90 < s[i] && s[i] < 97)
						s[i] += 6;
				}
				else if(70 < s[i] - k[i % n] && s[i] - k[i % n] < 97 && s[i] >= 97){
					s[i] = s[i] - k[i % n] - 6;
				}
				else if(s[i] >= 97 && s[i] - k[i % n] <= 70){
					s[i] = 52 + s[i] - k[i % n];
				}
				else{
					s[i] -= k[i % n];
				}
			}
		}
		printf("%s\n", s);
	}
	/*printf("%d\n", 'A');
	printf("%d\n", 'Z');
	printf("%d\n", 'a');
	printf("%d\n", 'z');
	printf("%d\n", '@');*/
	return 0;
}