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 <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 1000000
 
using namespace std;
typedef long long ll;
 



char back(char a,int bnum){
	int lest;
	if(bnum>26){
		bnum-=26;
		if('a'<=a && a<='z'){
			a=a+('A'-'a');
		}
		else if('A'<=a && a<='Z'){
			a=a+('a'-'A');
		}
	}
	if('a'<=a && a<='z'){//こもじ
		if(a-bnum>='a'){
			return a-bnum;
		}else{
			lest=(a-'a'+1)-bnum;
			return 'Z'+lest;
		}
	}else if('A'<=a && a<='Z'){//おおもじ
		if(a-bnum>='A'){
			return a-bnum;
		}else{
			lest=(a-'A'+1)-bnum;
			return 'z'+lest;
		}
	}
	return '+';
}

int main(){
	while(1){
	int n,k[101],key[101];
	cin>>n;
	if(n==0)break;

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

	int num=0;
	for(int i=0;i<101;i++){
		key[i]=k[num%(n)];
		num++;
	}
	for(int i=0;i<s.size();i++){
		s[i]=back(s[i],key[i]);
	}
	cout<<s<<endl;
	}
	return 0;
}

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

int main(){
    
    string str = "abcdefghijklmnopqrstuvwxyzABCDEFFGHIJKLMNOPQRSTUVWXYZ";
    str = str + str + str;

    while(1){
        int n; cin >> n;
        if(!n) break;
        vector<int> key(n);
        for(int i = 0; i < n; i++){
            cin >> key[i];
        }

        string s; cin >> s;
        int j = 0;
        int idx;
        for(int i = 0; i < s.size(); i++){
            for(int k = 52; k <= 103; k++){
                if(s[i] == str[k]) idx = k;
            }
            //cout << idx << " " << key[j];
            idx -= key[j];
            s[i] = str[idx];
            j++;
            if(j == n) j = 0;
        }

        cout << s << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

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

int main() {
  int len;
  while(cin >> len, len) {
    int list[len];
    for(int i=0; i<len; i++)
      cin >> list[i];
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i++)
      s[i] = decode(s[i],list[i%len]);
    cout << s << endl;
  }
}

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

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  vector<char> alp(52);
  REP(i,26){
    alp[i] = 'a' + i;
    alp[i+26] = 'A' + i;
  }
  
  while(true){
    int n;
    cin >> n;
    if(n == 0) break;

    vector<int> v(n);
    REP(i,n){
      cin >> v[i];
    }
    string s;
    cin >> s;

    int len = s.length();
    REP(i,len){
      int m;
      //cout << (s[i] - 'a') << " " << v[i%n] << endl;
      if(s[i] >= 'a' && s[i] <= 'z') m = (int(s[i] - 'a') - v[i%n] + 52)%52 ;
      else m = ((s[i] - 'A') + 26 - v[i%n] + 52) % 52;
      //cout << m << endl;
      cout << alp[m];
    }
    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;
    char ch=str[i];
    str[i]-=key[idx++]%26;
    
    if(str[i]<'A') str[i]='z'-('A'-str[i])+1;
    else if('a'<=ch&&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>

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

char decode(char c, int k){
    if('a' <= c && c <= 'z'){
        if(c - k >= 'a') return c - k;
        return decode('Z', k - (c - 'a') - 1);
    }
    if(c - k >= 'A') return c - k;
    return decode('z', k - (c - 'A') - 1);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    while(true){
        int n;
        cin >> n;
        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){
            cout << decode(s[i], k[i % n]);
        }
        cout << "\n";
    }
    return 0;
}