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 <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 10000000000LL
#define rep(i,n) for(i=0;i<n;i++)

typedef pair<int,int> pii;
int i,j;

int main(void) {
  int n;
  char alph[55]={"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};
  while(1){
    cin>>n;
    if(n==0)break;
    int k[105];
    rep(i,n)
      cin>>k[i];
    char str[105]={};
    cin>>str;
    int a=strlen(str);
    rep(i,a){
      int c;
      if('A'<=str[i] && str[i]<='Z')
        c=(int)(str[i]-'A')+26;
      else
        c=(int)(str[i]-'a');
      cout<<alph[(52+c-k[i%n])%52];
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cctype>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

char a[52];

char decode(char c, int k)
{
  int x = 0;
  while(a[x] != c)
    x++;
  x -= k;
  while(x < 0)
    x += 52;
  return a[x];
}

int main()
{
  REP(i,26)
    a[i] = 'a' + i;
  FOR(i,26,52)
    a[i] = toupper(a[i-26]);
  while(1){
    int n;
    cin >> n;
    if(n == 0) break;
    int k[n];
    REP(i,n)
      cin >> k[i];
    string s;
    cin >> s;
    int x = 0;
    REP(i,(int)s.size()){
      s[i] = decode(s[i],k[x]);
      x++;
      x %= n;
    }
    cout << s << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

string abcd;

void solve(int n){
	vl k(n);
	rep(i,n)cin>>k[i];
	string s;
	cin>>s;
	rep(i,s.size()){
		int c=(char)s[i]-'a';
		if(c<0)c=(char)s[i]-'A'+26;
		c=(c+52-k[i%k.size()])%52;
		s[i]=abcd[c];
	}
	cout<<s<<"\n";
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	rep(i,26)abcd.push_back((char)('a'+i));
	rep(i,26)abcd.push_back((char)('A'+i));
	while(cin>>n,n)solve(n);
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
int n;
main()
{
	while(cin>>n,n)
	{
		int k[100];
		for(int i=0;i<n;i++)cin>>k[i];
		string s;cin>>s;
		for(int i=0;i<s.size();i++)
		{
			int now=k[i%n];
			if(now>=26)
			{
				now-=26;
				s[i]^=32;
			}
			if(s[i]<'a')
			{
				if(s[i]-'A'<now)
				{
					now-=s[i]-'A'+1;
					s[i]='z'-now;
				}
				else s[i]-=now;
			}
			else
			{
				if(s[i]-'a'<now)
				{
					now-=s[i]-'a'+1;
					s[i]='Z'-now;
				}
				else s[i]-=now;
			}
		}
		cout<<s<<endl;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

int toint(char c)
{
    if (c >= 'a') {
        return (c - 'a');
    }
    return 26 + (c - 'A');
}

char tochr(int i)
{
    i = i % 52;
    if (i >= 26) {
        return 'A' + (char)(i - 26);
    } else {
        return 'a' + (char)(i);
    }
}

char decode(char c, int i)
{
    i = i % 52;
    const int j = toint(c);
    char ch;
    if (j >= i) {
        ch = tochr(j - i);
    } else {
        ch = tochr(j + 52 - i);
    }
    return ch;
}

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        vector<int> k(n);
        for (int i = 0; i < n; i++) {
            cin >> k[i];
        }
        string s;
        cin >> s;
        for (int i = 0; i < s.size(); i++) {
            cout << decode(s[i], k[i % n]);
        }
        cout << endl;
    }
    return 0;
}