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>
using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  vector<char> v(52);
  rep(i,26) v[i]='a'+i;
  rep(i,26) v[i+26]='A'+i;
  map<char,int> mp;
  rep(i,52) mp[v[i]]=i;
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    string s;
    cin >> s;
    int m = s.length();
    rep(i,m){
      s[i]=v[(mp[s[i]]-a[i%n]+52)%52];
    }
    cout << s << endl;
  }
  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<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

string eki = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
	int N;
	while(cin >> N && N)
	{
		vector<int> keys(N);
		rep(nth,N){
			cin >> keys[nth];
		}
		string S;
		cin >> S;
		
		string ans;
		int pos=0;
		rep( i, S.size() )
		{
			int num;
			if('a'<= S[i] && S[i] <= 'z'){
				num = S[i] - 'a';
			}
			else if('A' <= S[i] && S[i] <= 'Z'){
				num = S[i] - 39;
			}
			char res = eki[ ( num - keys[pos] + 52 ) % 52 ];
			pos = (pos+1)%N;
			ans += res;
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
 
int main(){
 
  int n, k[100], x, i, j;
  string sta="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", s;
 
  while(cin>>n, n){
    for(i=0;i<n;i++) cin>>k[i];
    cin>>s;
 
    for(i=0;i<s.size();i++){
      for(j=0;j<56;j++){
	if(s[i]==sta[j]){
	  x=j-k[i%n];
	  if(x<0){
	    x+=52;
	    break;
	  }else break;
	}
      }
      cout<<sta[x];
    }
    cout<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>

using namespace std;

int main()
{	
	vector<char> ls;

	int n;
	while(true)
	{
		cin >> n;
		if(n==0)break;
		vector<int> key(n);
		for(int i=0;i<n;i++)
			cin >> key[i];
		string s;
		cin >> s;
		string ans;
		for(int i=0;i<s.size();i++)
		{
			int tmp;
			if('a'<=s[i] and s[i]<='z')
				tmp=s[i]-'a';
			else
				tmp=s[i]-'A'+26;
			int aft=((tmp-key[i%n]+52)%52);
			if(aft<26)
				ans+=('a'+aft);
			else
				ans+=('A'+(aft-26));
		}

		cout << ans << endl;
	}





}