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
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const string stations = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main(){

  int n;
  while(~scanf("%d",&n)){
    if(n==0) break;

    int back_dist[101];
    for(int i=0;i<n;i++){
      scanf("%d",back_dist+i);
    }
    string str;
    cin >> str;

    int back_idx = 0;
    for(int i=0;i<str.size();i++){
      int pos = lower_bound(stations.begin(),stations.end(),str[i]) - stations.begin();
      str[i] = stations[(pos - back_dist[back_idx] + stations.size()) % stations.size()];
      back_idx++;
      back_idx %= n;
    }

    cout << str << endl;
  }
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

char mae(char c, int n) {
  char d = c - n;
  if ('a' <= c && c <= 'z' && d < 'a') {
    d += 'Z' - 'a' + 1;
  }
  else if ('A' <= c && c <= 'Z' && d < 'A') {
    d += 'z' - 'A' + 1;
  }
  return d;
}

int main() {

  for (int n; cin >> n, n; ) {
    vector<int> xs(n);
    rep (i, n) cin >> xs[i];
    string s; cin >> s;
    const int m = s.size();
    rep (i, m) {
      s[i] = mae(s[i], xs[i % n]);
    }
    cout << s << endl;
  }

  return 0;
}

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

string ab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, key[100];
    string cip;
    while(cin >> n && n){
        for(int i = 0; i < n; i++){
            cin >> key[i];
        }
        cin >> cip;
        for(int i = 0; i < cip.size(); i++){
            int ind = lower_bound(ab.begin(), ab.end(), cip[i])-ab.begin();
            cout << ab[(ind - key[i%n] + 52) % 52];
        }
        cout << endl;
    }
    return 0;
}

C++: #include "bits/stdc++.h"
#define pb push_back
#define mt make_tuple
#define all(a) (a).begin(),(a).end()
#define frep(i,a,n) for(int i=(a);i<(n);++i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define rrep(i, n) for(int i=n-1;i>=0;--i)
#define debug(x) cout << #x << " : " << x << " ------------ " << endl;
using namespace std;
int main()
{
    string letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int n;
    while (cin >> n, n) {
        vector<int> k(n);
        rep(i, n) cin >> k[i];
        string s;
        cin >> s;
        auto kIt = k.begin();
        auto lbIt = letters.cbegin();
        rep(i, s.length()) {
            auto lIt = lbIt + letters.find(s[i]);
            rep(j, *kIt) {
                if (lIt == lbIt) lIt = letters.end();
                --lIt;
            }
            cout << *lIt;
            if (++kIt == k.end()) kIt = k.begin();
        }
        cout << endl;
    }
    
    return EXIT_SUCCESS;
}

C++: #include<cstdio>
#include<algorithm>

using namespace std;

int main(void) {
    char list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    while(true) {
        int n,k[200];
        char s[150]={};

        scanf("%d", &n);
        if(!n) break;

        for(int i=0; i<n; i++)
            scanf("%d", &k[i]);

        scanf("%s",s);

        for(int i=0; s[i]; i++) {
            printf("%c", list[((lower_bound(list, list+52, s[i])-list)-k[i%n])%52]);
        }
        printf("\n");
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

void rotate(char& c, int k) {
	while (k--) {
		if (c == 'A') c = 'z';
		else if (c == 'a') c = 'Z';
		else c--;
	}
}

int main() {
	for (;;) {
		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 j = 0; j < s.length(); j++)
			rotate(s[j], k[j % n]);
		cout << s << endl;
	}
}