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 FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	
	while (1) {
		int n;
		int now;
		int pos = 1;
		string s;

		cin >> n;
		vector<int> k(n + 1);
		if (n == 0) {
			break;
		}
		FOR(i, 1, n) {
			cin >> k[i];
		}
		cin >> s;

		FOR(i, 0, s.size() - 1) {
			now = k[pos];
			if ('a' <= s[i] && s[i] <= 'z') {
				if (s[i] - now >= 'a') {
					s[i] -= now;
				}
				else {
					now = 'a' - (s[i] - now);
					if (now <= 26) {
						s[i] = 'Z' - now + 1;
					}
					else {
						now -= 26;
						s[i] = 'z' - now + 1;
					}
				}
			}
			else {
				if (s[i] - now >= 'A') {
					s[i] -= now;
				}
				else {
					now = 'A' - (s[i] - now);
					if (now <= 26) {
						s[i] = 'z' - now + 1;
					}
					else {
						now -= 26;
						s[i] = 'Z' - now + 1;
					}
				}
			}
			cout << s[i];
			pos++;
			if (pos == n + 1) {
				pos = 1;
			}
		}
		cout << endl;
	}
}

C++: #include<iostream>
using namespace std;
#include<vector>

int main(){
  while(1){
    int n;
    cin>>n;
    int a;
    if(n==0)break;
    vector<int> k(n);
    string s;
    for(int i=0;i<n;i++)cin>>k[i];
    cin>>s;
    for(int i=0;i<s.size();i++){
      if(k[i%k.size()]<=26){
        a=s[i]-k[i%k.size()];
        if(a<65&&s[i]>=65&&s[i]<=90){
           a+=58;
         }else if(a<97&&s[i]>=97&&s[i]<=122)a-=6;
      }else{
        a=s[i]+(52-k[i%k.size()]);
        if(a>122&&s[i]>=122&&s[i]>=97){
          a-=58;
        }else if(a>90&&s[i]<=90&&s[i]>=65)a+=6;
      }
      putchar(a);
      //cout<<" "<<a<<" "<<k[i%k.size()]<<" "<<s[i]<<endl;
    }
    cout<<endl;
  }
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)

int main() {
    string ls;
    REP(i,26)ls.push_back('a'+i);
    REP(i,26)ls.push_back('A'+i);
    REP(i,26)ls.push_back('a'+i);
    REP(i,26)ls.push_back('A'+i);

    while(1){
        int n;
        cin >> n;
        if(n==0)break;
        vector<int> k;
        REP(i,n){
            int t;
            cin >> t;
            k.push_back(t);
        }
        string s,ans="";
        cin >> s;
        REP(i,s.size()){
            if(s[i]<='Z'){
                ans.push_back(ls[s[i]-'A'+26*3-k[i%n]]);
            }
            else{
                ans.push_back(ls[s[i]-'a'+26*2-k[i%n]]);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 100000000;

string sta = "abcdefghijklmnopqrstuvwxyz";

int stanum(char c){
	rep(i, sta.size()){
		if(c == sta[i]) return i;
	}
	return -1;
}

int main(){
	rep(i, 26){
		sta += sta[i]+'A'-'a';
	}


	while(1){
		int n;
		cin >> n;
		if(!n)break;
		vector<int> k(n);
		rep(i, n){
			cin >> k[i];
		}
		string s;
		cin >> s;
		rep(i, s.size()){
			s[i] = sta[(stanum(s[i])+sta.size()-k[i%k.size()])%sta.size()];
		}
		cout << s << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <string>
using namespace std;

string answer(string t, int a, int b[]){
	string r="";
	char station[53];
	for(int i=0; i<26; ++i) station[i]='a'+i;
	for(int i=26; i<53; ++i) station[i]='A'+(i-26);
	
	for(int i=0; i<t.size(); ++i){
		if('a'<=t[i])	 r+=station[ (t[i]-'a'-b[i%a]+52)%52 ]; //小文字の時
		else r+=station[ (t[i]-'A'+26-b[i%a]+52)%52 ]; //大文字の時	
	}
	return r;	
}

int main(){
	while(1){
		int n, k[100];
		string s;
		
		//入力
		scanf(" %d", &n);
		if(n==0) break;
		for(int i=0; i<n; ++i) scanf(" %d", &k[i]);
		cin >> s;
		
		cout << answer(s, n, k) << endl;
	}
	return 0;
}

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

int n;
char ls[52];
string s, ans;

void solve(char c, int x);

int main() {
  int i;
  for(i = 0; i < 52; ++i) {
    if(i < 26)
      ls[i] = 'a' + i;
    else
      ls[i] = 'A' + i % 26;
  }
  while(1) {
    cin >> n;
    if(n == 0) break;
    vector<int> v;
    for(i = 0; i < n; ++i) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    cin >> s;
    for(i = 0; i < s.size(); ++i) solve(s[i], v[i % v.size()]);
    cout << ans << endl;
    ans = "";
  }
  return 0;
}

void solve(char c, int x) {
  int now;
  if(c >= 'a' && c <= 'z')
    now = c - 'a';
  else
    now = c - 'A' + 26;
  ans += ls[(now - x + 52) % 52];
}