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++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl

using namespace std;
typedef long long int ll;
typedef string::const_iterator State;
typedef pair<int,int> P;
class ParseError {};
const ll INF=1LL<<50;
char fi[101][101];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
double EPS = 1e-14;
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003



int bow[353][353]={0};
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b)))
	return 0;
	return a+b;
}

/*struct P{
	double x,y;
	P(){}
		P(double x,double y):x(x),y(y){
		}
		P operator + (P p){
			return P(add(x,p.x),add(y,p.y));
		}
		P operator - (P p){
			return P(add(x,-p.x),add(y,-p.y));
		}
		P operator *(double d){
			return P(x*d,y*d);
		}
		double dot(P p){
			return add(x*p.x,y*p.y);
		}
		double det(P p){
			return add(x*p.y,-y*p.x);
		}
};

bool cmp_x(const P& p,const P& q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}

vector<P> convex_hull(P* ps, int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> 	qs(n*2);
	
	rep(i,n){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
			k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
		k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}

int n,m;
vector<double> p;
P ps[101];
*/
//char c[520][520];
long long mod=1000000007;
long long pow(ll i,ll j){
	ll tmp=1;
	while(j){
		if(j%2) tmp=tmp*i%mod;
		i=i*i%mod;
		j/=2;
	}
	return tmp;
}

int expression(State&);
int term(State&);
int factor(State&);
int number(State&);
int expression(State &begin){
	int ret = term(begin);
	
	for(;;){
		if(*begin == '+'){
			begin++;
			ret += term(begin);
		}
		else if(*begin == '-'){
			begin++;
			ret -= term(begin);
		}
		else
			break;
	}
	return ret;
}

int term(State &begin){
	int ret = factor(begin);
	
	for(;;){
		if(*begin=='*'){
			begin++;
			ret *= factor(begin);
		}
		else if(*begin=='/'){
			begin++;
			ret /= factor(begin);
		}
		else
			break;
	}
	return ret;
}

int factor(State &begin){
	int ret;
	if(*begin == '('){
		begin++;
		ret = expression(begin);
		begin++;
	}
	else
	ret = number(begin);
	
	return ret;

}

int number(State &begin){
	int ret =0;
	
	while(isdigit(*begin)){
		ret*=10;
		ret+=*begin - '0';
		begin++;
	}
	return ret;
}



int main(void){
	
	int n;
	
	while(cin>>n,n!=0){
		vector<ll> c(n);
		
		for(int i=0;i<n;i++){
			cin>>c[i];
		}
		
		string s;
		cin>>s;
		
		ll k=0;
		for(int i=0;i<s.size();i++){
			if(s[i]>='A'&&s[i]<='Z'){
				if(s[i]-'A'<c[k%n]){
					int tmp=c[k%n]-(s[i]-'A'+1);
					if('z'-'a'<tmp)
					s[i]='Z'-(tmp-('z'-'a'+1));
					else
					s[i]='z'-tmp;
				}
				else
					s[i]=s[i]-c[k%n];
			}
			else if(s[i]>='a'&&s[i]<='z'){
				if(s[i]-'a'<c[k%n]){
					int tmp=c[k%n]-(s[i]-'a'+1);
					if('Z'-'A'<tmp)
					s[i]='z'-(tmp-('Z'-'A'+1));
					else
					s[i]='Z'-tmp;
				}
				else
					s[i]=s[i]-c[k%n];
			}
				k++;
			}
		cout<<s<<endl;
		
		}
		
	
	
		
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007LL;
const double INF=1000000000;
const int MAX=100001;
int main(){
    int n;
    while(cin>>n,n){
        int k[110];
        for(int i=0;i<n;i++){
            cin>>k[i];
        }
        string s;
        cin>>s;
        for(int i=0;i<s.length();i++){
            int a;
            if(s[i]>='a'&&s[i]<='z'){
                a=s[i]-'a';
            }else{
                a=s[i]-'A'+26;
            }
            a-=k[i%n];
            if(a<0){
                a+=52;
            }
            if(a<26){
                s[i]='a'+a;
            }else{
                s[i]='A'+a-26;
            }
        }
        cout<<s<<endl;
    }
    return 0;
}

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

int main(){
  int a,b,c;
  string s,h="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  queue<int> q;
  while(1){
    cin>>a;
    if(a==0)break;
    while(q.size()!=0)q.pop();
    for(int i=0;i<a;i++){
      cin>>b;
      q.push(b);
    }
    cin>>s;
    for(int i=0;i<s.size();i++){
      if('a'<=s[i]&&s[i]<='z')c=s[i]-'a';
      else if('A'<=s[i]&&s[i]<='Z')c=s[i]-'A'+26;
      //cout<<c<<" ";///////////
      c-=q.front();
      //xcout<<c<<endl;///////////
      if(c<0)c=h.size()-c-1;
      q.push(q.front());q.pop();
      cout<<h[c];
    }
    cout<<endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int n;
  while(cin >> n,n){
    vector<int> key(n);
    rep(i,n) cin >> key[i];
    int x = 0;
    string str;
    cin >> str;
    while(key.size() < str.size()){
      if(x==key.size()) x = 0;
      key.push_back(key[x]);
      x++;
    }
    rep(i,str.size()){
      rep(j,key[i]){
        if(str[i]=='a') str[i] = 'Z';
        else if(str[i]=='A') str[i] = 'z';
        else str[i]--;
      }
    }
    rep(i,str.size()) cout << str[i];
    cout << endl;
  }
  return 0;
}