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 <string>

using namespace std;

int main() {
    int n;
    int key[100];
    string s;
    while (true) {
        cin >> n;
        if (n == 0) {
            break;
        }
        for (int i=0; i<n; i++) {
            cin >> key[i];
        }
        cin >> s;
        for (int i=0; i<(int)s.length(); i++) {
            char c = s[i];
            for (int j=0; j<key[i%n]; j++) {
                if (c == 'a') {
                    c = 'Z';
                }
                else if (c == 'A') {
                    c = 'z';
                }
                else {
                    c--;
                }
            }
            cout << c;
        }
        cout << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdint>
#include <cctype>
#include <cassert>
#include <vector>
#include <algorithm>
#include <string>

int encode(int ch) {
  if (islower(ch)) return ch - 'a';
  if (isupper(ch)) return ch - 'A' + 26;
  assert(false);
}

int decode(int ch) {
  if (ch < 26) return ch + 'a';
  if (ch < 52) return ch - 26 + 'A';
  assert(false);
}

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  std::vector<int> k(n);
  for (auto& ki: k) scanf("%d", &ki);

  char buf[128];
  scanf("%s", buf);
  std::string s = buf;

  for (size_t i = 0; i < s.length(); ++i) {
    int d = encode(s[i]);
    (d -= k[i % n]) %= 52;
    if (d < 0) d += 52;
    s[i] = decode(d);
  }

  printf("%s\n", s.c_str());
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}

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

string str, k_list;
int k[111];

int main(){

 for (int i = 0; i < 26; i++) {
   str += (char)('a' + i);
 }
 for (int i = 0; i < 26; i++) {
   str += (char)('A' + i);
 }


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

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

   cin>>k_list;
   int size = k_list.length();

   /*for (int i = 0; i < size; i++) {
     if('a' <= k_list[i] && k_list[i] <= 'z') {
       if (k_list[i] - 'a' + 26 > k[i%n])

       if ('a' <= k_list[i] - k[i%n] && k_list[i] - k[i%n] <= 'z') {
         cout<<(char)(k_list[i] - k[i%n]);
       } else {
         cout<<(char)(k_list[i] - k[i%n] - 'a' + 'Z' + 1);
       }
     } else {
       if('A' <= k_list[i] - k[i%n] && k_list[i] - k[i%n] <= 'Z') {
         cout<<(char)(k_list[i] - k[i%n]);
       } else {
         cout<<(char)(k_list[i] - k[i%n] - 'A' + 'z' + 1);
       }
     }
   }*/

   for (int i = 0; i < size; i++) {
     if('a' <= k_list[i] && k_list[i] <= 'z') {
       cout<<str[(52+k_list[i]-'a'-k[i%n])%52];
     } else {
       cout<<str[(52+k_list[i]-'A'+26-k[i%n])%52];
     }
   }
   cout<<endl;
 }



}

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

using namespace std;
const string str1({"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"});
const string str2({"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"});

int32_t main() {
  while (true) {
    uint32_t n = 0;
    cin >> n;
    if (n == 0) break;
    vector<uint32_t> keys;
    for (uint32_t i = 0; i < n; i++) {
      uint32_t key;
      cin >> key;
      keys.push_back(key);
    }

    string list;
    cin >> list;
    uint32_t key_index = 0;
    for (uint32_t i = 0; i < list.size(); i++) {
      char val;
      if ('A' <= list[i] && list[i] <= 'Z') {
        val = str1[str1.find(list[i]) - keys[key_index]];
      } else {
        val = str2[str2.find(list[i]) - keys[key_index]];
      }
      cout << val;
      key_index++;
      key_index %= keys.size();
    }
    cout << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
    int n;
    while(cin >> n, n){
        vi d(n);
        rep(i, 0, n){
            cin >> d[i];
        }
        string s;
        string str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        cin >> s;
        rep(i, 0, s.size()){
            int p = str.find(s[i]);
            p -= d[i % n];
            if(p < 0) p += 52;
            s[i] = str[p];
        }
        cout << s << endl;
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
int main() {
  int n;
  string s;
  while (cin >> n, n) {
    int K[n];
    for (int i = 0; i < n; ++i) cin >> K[i];
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i]-K[i%n] < 'a' && s[i] >= 'a') {
	s[i] = 'Z' - 'a' - K[i%n] + s[i] + 1;
	if (s[i] < 'A') s[i] = 'z' - 'A' + s[i] + 1;
      } else if (s[i]-K[i%n] < 'A' && s[i] >= 'A') {
	s[i] = 'z' - 'A' - K[i%n] + s[i] + 1;
	if (s[i] < 'a') s[i] = 'Z' - 'a' + s[i] + 1;
      }else s[i] -= K[i%n];
    }
    cout << s << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n;
  int k[100];
  string s;
  string ans;
  while(1){
    cin>>n;
    if(n==0) break;
    rep(i,n){
      cin>>k[i];
    }
    cin>>s;
    ans="0";
    rep(i,s.size() ){
      int a=s[i]-k[i%n];
      if(a<65) a+=58;
      if(a<65) a+=58;
      if(a<97 && a>90) a-=6;
      ans+=a;
    }
    repi(i,1,ans.size()){
      cout<<ans[i];
    }
    cout<<endl;
  }

  return 0;
}