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 <algorithm>
#include <vector>
#include <string>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<char> alp(0);
	for (char c = 'a'; c <= 'z'; c++) { alp.push_back(c); }
	for (char c = 'A'; c <= 'Z'; c++) { alp.push_back(c); }
	int n; while ( cin >> n && n != 0 )
	{
		vector<int> dat(n + 2, 0);
		rep(i, n) { cin >> dat[i]; }
		string str; cin >> str;
		int lp1 = 0, lp2 = 0;
		while (1)
		{
			if (lp1 == n) { lp1 = 0; }
			if (lp2 == (int)str.size()) { break; }
			cout << alp[(find(all(alp), str[lp2]) - alp.begin() - dat[lp1] + alp.size()) % alp.size()];
			lp1++; lp2++;
		}
		cout << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <string>
using namespace std;


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

char x[60];

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



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

    cin >> str;
    for(int i = 0,j = 0; i < str.size() ; i++,j++){
      if(i % n == 0) j = 0;
      
      char tmp = str[i] - key[j]; 
   
      if(str[i] - key[j] < 'A' ){
	str[i] += 52 + 6;
      }
      if(str[i] >= 'a' && str[i] - key[j] < 'a') str[i] -= 6;
      str[i] -= key[j];
    }
    cout << str << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

	string alphabets;
	{
		string lowers, uppers;
		REP( i, 0, 26 )
		{
			lowers += 'a' + i;
			uppers += 'A' + i;
		}
		alphabets = lowers + uppers;
	}

	for ( int n; cin >> n, n; )
	{
		VI ks( n );
		FOR( k, ks )
		{
			cin >> k;
		}

		string str;
		cin >> str;

		REP( i, 0, str.size() )
		{
			const int p = alphabets.find( str[i] );
			cout << alphabets[ ( p - ks[ i % ks.size() ] + 52 ) % 52 ];
		}
		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 (char)(c - didx);
    return 'Z' - ('a' - (c - didx)) + 1;
  }
  // isupper
  if ('A' <= (c - didx))
    return c - didx;
  return 'z' - ('A' - (c - didx)) + 1;
}

string solve() {
  const int M = s.size();
  string ret = s;
  int idx = 0;
  rep(i,M) {
    ret[i] = chg(s[i], key[idx]);
    // printf("src:[%d] dist:[%d] key:[%d]\n", s[i], ret[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<string>
using namespace std;
int d[101];
char f(char c,int x){
	if(x==52)return c;
	int dif=x%26;
	if(c>='a'){
		c-=dif;
		if(c<'a'){
			c-=('a'-'Z'-1);
		}
	}
	else{
		c-=dif;
		if(c<'A'){
			c-=('A'-'z'-1);
		}
	}
	if(x/26==1){
		if(c>='a')c-=('a'-'A');
		else c+=('a'-'A');
	}
	return c;
}
int main(){
	int n;
	while(cin>>n && n){
		for(int i=0;i<n;i++){
			cin>>d[i];
		}
		string str;
		cin>>str;
		for(int i=0;i<str.size();i++){
			str[i]=f(str[i],d[i%n]);
		}
		cout<<str<<endl;
	}
}

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

using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,k[110];
    string s,t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

    while(1){
        cin>>n;

        if(n==0)break;

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

        cin>>s;
        int pos=0;//使うカギの番号

        for(int i=0;i<s.size();i++){
            if(s[i]>='a'&&s[i]<='z'){
                int p=s[i]-'a';
                p-=k[pos];
                if(p<0)p+=52;
                cout<<t[p];
            }
            else{
                int p=s[i]-'A'+26;
                p-=k[pos];
                if(p<0)p+=52;
                cout<<t[p];
            }
            pos++;
            pos%=n;
        }
        cout<<endl;
    }

}