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 _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
const int MAX_N=100;
int k[MAX_N];
int n;
string s;
void solve(){
  int p=0, u,l;
  for(char c:s){
    u=c-'A';
    l=c-'a';
    if(l>=0){
      l-=k[p];
      if(l<0)cout<<(char)(l+'A'+26);
      else cout<<(char)(l+'a');
    }else{
      u-=k[p];
      if(u<0)cout<<(char)(u+'a'+26);
      else cout<<char(u+'A');
    }
    p=(p+1)%n;
  }
  cout<<endl;
}
int main(){ _;
  while(cin>>n,n!=0){
    REP(i,n)cin>>k[i];
    cin>>s;
    solve();
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int ks[110];

int toIndex(char c){
    if('a' <= c && c <= 'z'){
        return c - 'a';
    }
    return c - 'A' + 26;
}

char toChar(int idx){
    if(0 <= idx && idx < 26){
        return (char)('a' + idx);
    }
    return (char)('A' + (idx - 26));
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    while(true){
        int N;
        std::cin >> N;
        if(!N){break;}

        for(int i=0;i<N;++i){
            std::cin >> ks[i];
        }

        string S;
        std::cin >> S;

        int L = S.size();
        for(int i=0;i<L;++i){
            char d = toChar((toIndex(S[i]) + 52 - ks[i % N]) % 52);
            std::cout << d;
        }

        std::cout << std::endl;
    }
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N;
  int k[100];
  while(cin >> N && N){
    REP(i, N) cin >> k[i];
    string s;
    cin >> s;
    char cs[52];
    REP(i, 26) cs[i] = 'a' + i;
    REP(i, 26) cs[i + 26] = 'A' + i;
    string t = s;
    REP(i, s.size()){
      int idx;
      REP(j, 52) if(s[i] == cs[j]) idx = j;
      t[i] = cs[ (idx - k[i % N] + 52) % 52];
    }
    cout << t << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = (1e-10);
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

string solve(int N) {
    vector<int> key(N);
    for (int i = 0; i < N; i++) {
        cin >> key[i];
    }
    string S; cin >> S;
    string ret;

    map<char, int> ctoi;
    map<int, char> itoc;
    for (int i = 0; i < 26; i++) {
        itoc[i] = 'A' + i;
        ctoi[itoc[i]] = i; 
        itoc[i+26] = 'a' + i;
        ctoi[itoc[i+26]] = i+26;
    } 
    for (int i = 0; i < S.length(); i++) {
        ret.push_back(itoc[(ctoi[S[i]] - key[i%N] + 52) % 52]);
    }
    return ret;
}

int main(void) {
    vector<string> ans;
    int N;
    while (1) {
        cin >> N;
        if (!N) break;
        ans.push_back(solve(N));
    }
    for (auto &i : ans) {
        cout << i << endl;
    }
}

C++: #include <cstdio>
#include <iostream>
#include <string.h>

using namespace std;

void decode(int l, int k[108], char s[108])
{
	char alph[56];
	int num[108];
	
	for(int i = 0; i < 26; i++){
		alph[i] = 'a' + i;
	}
	for(int i = 0; i < 26; i++){
		alph[i + 26] = 'A' + i;
	}
	
	for(int i = 1; i <= l; i++){
		if(s[i - 1] >= 'a' && s[i - 1] <= 'z'){
			num[i] = s[i - 1] - 'a';
		}
		else{
			num[i] = s[i - 1] - 'A' + 26;
		}
		if(num[i] - k[i] < 0){
			while(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[108];
	char s[108];
	
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = 1; 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] = k[i];
			}
			m += n;
		}
		decode(l, k, s);
	}
	return 0;
}