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 <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 89;
	char alp[52]; for (int i = 0; i < 26; i++) alp[i] = (char)('a' + i); for (int i = 0; i < 26; i++) alp[i + 26] = (char)('A' + i);
	while (kkt) {
		ll n; cin >> n; if (n == 0) break;
		vector<ll> k(n); for (int i = 0; i < n; i++) scanf("%lld", &k[i]);
		string s; cin >> s;
		string res;
		for (int i = 0; i < s.size(); i++) {
			int c;
			for (int j = 0; j < 52; j++) if (s[i] == alp[j]) c = j;
			c -= k[i % n];
			c %= 52;
			if (c < 0) c += 52;
			res += alp[c];
		}
		cout << res << "\n";
	}
	return 0;

}

C++: #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] <= 'Z' ){
	str[i] += 52 + 6;
      }else  if(str[i] - key[j] < 'A' && str[i] >= 'Z' ){
	str[i] += 52;
      }
      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 <vector>
using namespace std;

int toint(char a){
  if('a'<=a && a<='z'){
    return a-'a';
  }else{
    return a-'A'+26;
  }
}

char tochar(int n){
  if(0<=n && n<=25){
    return 'a'+n;
  }else{
    return 'A'+n-26;
  }
}

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

    vector<int> key(n);
    string str;
    for(int i=0; i<n; i++){
      cin >> key[i];
    }
    cin >> str;

    for(unsigned int i=0; i<str.length(); i++){
      str[i] = tochar( (toint(str[i]) +52 -key[i%key.size()])%52 );
    }
    cout << str << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
  int n;
  while(cin>>n,n){
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    string s;
    cin>>s;
    rep(i,s.size()){
      char tmp=(char)s[i]-a[i%n];
      //cout<<"tmp="<<tmp<<endl;
      if('Z'<tmp&&tmp<'a'){
        int len=a[i]-(s[i]-'a')-1;
        cout<<(char)('Z'-len);
      }else if(tmp<'A'){
        int len=a[i]-(s[i]-'A')+2;
        cout<<(char)('z'-len);
      }else{
        cout<<tmp;
      }
    }
    cout<<endl;


  }
 return 0;
}

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

using i64 = int64_t;

map<char, int> mp;

string init(){
    string res = "";
    for(char c='a';c<='z';++c){
        res.push_back(c);
        mp[c] = c - 'a';
    }
    for(char c='A';c<='Z';++c){
        res.push_back(c);
        mp[c] = c - 'A' + 26;
    }
    return res;
}

int main(){
    int n;
    string alphabets = init();
    while(cin >> n, n != 0){
        vector<int> v;
        for(int i=0;i<n;++i){
            int k;
            cin >> k;
            v.push_back(k);
        }
        string s;
        cin >> s;
        string ans = "";
        int idx = 0;
        for(auto e: s){
            int i = mp[e] - v[idx];
            if(i < 0)i += 52;
            ans.push_back(alphabets[i]);
            idx++;
            idx %= (int)v.size();
        }
        cout << ans << endl;
    }

    return 0;
}