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,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    //rep(i,0,128)cout << (char(i));
    int N;
    cin >> N;
    while(N){
        vector<int> V(N);
        rep(i,0,N)cin >> V[i];
        string s;
        cin >> s;
        int M = s.size();
        rep(i,0,M){
            int num = s[i] - 'A';
            if(num >= 26)num -= 6;
            num = (num - V[i%N] + 52) % 52;
            if(num >= 26)num += 6;

            s[i] = 'A' + num;
        }
        cout << s << endl;
        cin >> N;
    }
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

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

int main() {

  for (int n; cin >> n, n; ) {
    vector<int> xs(n);
    rep (i, n) cin >> xs[i];
    string s; cin >> s;
    rep (i, s.size()) {
      cout << mae(s[i], xs[i % n]);
    } cout << endl;
  }

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int N;
int key[102];
string s;

void inc(int& idx) {
  ++idx;
  idx %= N;
}

char chg(char c, int didx) {
  if (islower(c)) {
    if ('a' <= (c - didx))
      return c - didx;
    return ('Z' + 1) - ('a' - (c - didx));
  }
  // isupper
  if ('A' <= (c - didx))
    return c - didx;
  return ('z' + 1) - ('A' - (c - didx));
}

string solve() {
  const int M = s.size();
  string ret = s;
  int idx = 0;
  rep(i,M) {
    ret[i] = chg(s[i], key[idx]);
    inc(idx);
  }
  return ret;
}

int main() {
  while (cin >> N, N) {
    rep(i,N) cin >> key[i];
    cin >> s;
    cout << solve() << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>


using namespace std;
int getIndex(char c){
  if(c >= 'a' && c <= 'z')return c - 'a';
  else return c - 'A' + 26;
}
int main(){
  int n;
  vector<int> key;
  string offset="";
  for(int i = 0; i < 26; i++){
    offset += 'a' + i;
  } 
  for(int i = 0; i < 26; i++){
    offset += 'A' + i;
  }
  while( cin >> n, n){
    key.clear();    
    while(n--){
      int k;
      cin >> k;
      key.push_back(k);
    }
    string s;
    cin >> s;
    for(int i = 0; i < (int)s.size();i++) {
      cout << offset[ (getIndex(s[i])+52-key[i%key.size()]) % 52];
    }
    cout << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int key[101];

int main(){
  int n;
  while(cin>>n,n){
    for(int i=0;i<n;i++) cin>> key[i];
    string str;
  cin>>str;
  int idx=0;
  for(int i=0;i<str.size();i++){
    idx%=n;
    int flg=0;
    if(key[idx]>=26)flg=1;
    int t=key[idx++]%26;
    str[i]-=t;

    if(str[i]<'A') str[i]='z'-('A'-str[i])+1;
    else if('a'<=str[i]+t&&str[i]<'a') str[i]='Z'-('a'-str[i])+1;

    if(flg&&'a'<=str[i]&&str[i]<='z')str[i]-=32;
    else if(flg) str[i]+=32; 
  }
  cout <<str<<endl;
  }
  return 0;
}

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

using namespace std;

typedef long long LL;
typedef vector<int>    VI;
typedef vector<bool>   VB;
typedef vector<string> VS;

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int n;
VI ks;
string s;

int main(void) {
	string alpha;
	rep (i, 26) {
		alpha += 'a' + i;
	}
	rep (i, 26) {
		alpha += 'A' + i;
	}
	reverse(ALL(alpha));
	while (1) {
		ks.clear();
		cin >> n;
		if (n == 0) break;
		rep (i, n) {
			int k;
			cin >> k;
			ks.PB(k);
		}
		cin >> s;
		string ans;
		rep (i, s.size()) {
			int idx = 0;
			rep (j, alpha.size()) {
				if (s[i] == alpha[j]) {
					idx = j;
					break;
				}
			}
			ans += alpha[(idx + ks[i % ks.size()]) % alpha.size()];
		}
		cout << ans << endl;
	}
    return 0;
}