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 loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
string alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define int ll
signed main(){
    int n;
    map<char,int>key;
    rep(i,alpha.size())key[alpha[i]] = i;
    while(cin >> n,n){
        vector<int>v(n);
        rep(i,n)cin >> v[i];
        int num = 0;
        string s; cin >> s;
        rep(i,s.size()){
            int base = key[s[i]];
            rep(j,v[num]){
                base --;
                if(base == -1)base = alpha.size()-1;
            }
            cout << alpha[base];
            num ++;
            if(num  == n) num = 0;
        }
        cout << endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <map>
#include <set>

using namespace std;

string alpha;
int poses[1001];

int main(){

  for(char ch='a';ch<='z';ch++){
    alpha+=ch;
    poses[ch]=(int)alpha.size()-1;
  }
  for(char ch='A';ch<='Z';ch++){
    alpha+=ch;
    poses[ch]=(int)alpha.size()-1;
  }
  int N;
  while(cin>>N&&N){
    vector<int> keys;
    for(int i=0;i<N;i++){
      int a;
      cin>>a;
      keys.push_back(a);
    }
    string str;
    cin>>str;
    int pos=0;
    for(int i=0;i<(int)str.size();i++){
      int a=keys[pos];
      int op=poses[str[i]];
      op=(op-a+(int)alpha.size())%(int)alpha.size();
      cout<<alpha[op];
      pos=(pos+1)%(int)keys.size();
    }
    cout<<endl;
  }
  
  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <cstring>
 
using namespace std;
 
int num[108];
 
void decode(int l, int k[200], char s[108], char alph[56])
{   
    for(int i = 0; i < l; i++){
        if(s[i] >= 'a' && s[i] <= 'z'){
            num[i] = s[i] - 'a';
        }
        else{
            num[i] = s[i] - 'A' + 26;
        }
        if(num[i] - k[i] < 0){
            num[i] += 52 - k[i];
        }
        else{
            num[i] -= k[i];
        }
        cout << alph[num[i]];
    }
    puts("");
}
 
 
int main()
{
    int n, m, l;
    int k[200];
    char s[108];
    char alph[56];
     
    for(int i = 0; i < 26; i++){
        alph[i] = 'a' + i;
    }
    for(int i = 0; i < 26; i++){
        alph[i + 26] = 'A' + i;
    }
 
     
    while(scanf("%d", &n) != EOF){
        if(n == 0) break;
        for(int i = 0; i < n; i++){
            cin >> k[i];
        }
        cin >> s;
         
        m = n;
        l = strlen(s);
        while(l > m){
            for(int i = 1; i <= n; i++){
                k[m + i - 1] = k[i - 1];
            }
            m += n;
        }
        decode(l, k, s, alph);
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n;
	while (cin >> n, n) {
		vector<int>v(n); rep(i, 0, n)cin >> v[i];
		string s; cin >> s;
		int x = 0;
		rep(i, 0, s.size()) {
			rep(j, 0, v[x%n]) {
				if (s[i] == 'a') {
					s[i] = 'Z';
					continue;
				}
				else if (s[i] == 'A') {
					s[i] = 'z';
					continue;
				}
				s[i]--;
			}
			x++;
		}
		cout << s << endl;
	}
	return 0;
}