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 <string>
#include <climits>
#include <vector>

using namespace std;

int main() {
	int n;

	while(true) {
		cin >> n;

		if(!n) {
			break;
		}

		vector< int > k(n);
		string str;

		for(int i = 0; i < k.size(); i++) {
			cin >> k[i];
		}
		cin >> str;

		int tmp = 0, count = 0;
		string ans;

		for(int i = 0; i < str.size(); i++) {
			str[i] -= k[count];
			count++;
			if(count == k.size()) {
				count = 0;
			}
		}


		for(int i = 0; i < str.size(); i++) {
			if(str[i] < 'A') {
				tmp = 'A' - str[i];
				if(tmp < 26) {
					str[i] = ('z' + 1) - tmp;
				} else if(26 <= tmp && tmp < 52) {
					tmp -= 26;
					str[i] = ('Z' + 1) - tmp;
				} else if(tmp >= 52) {
					tmp = tmp % 52;
					str[i] = str[i] - tmp;
					if(str[i] < 'A') {
						tmp = 'A' - str[i];
						str[i] = ('z' + 1) - tmp;
					}
				}
			} else if('Z' < str[i] && str[i] < 'a') {
				tmp = ('a' - str[i]);
				cout << tmp << endl;
				if(tmp < 26) {
					str[i] = ('Z' + 1) - tmp;
				} else if(26 <= tmp && tmp < 52) {
					tmp -= 26;
					str[i] = ('z' + 1) - tmp;
				} else if(tmp >= 52) {
					tmp = tmp % 52;
					str[i] = str[i] - tmp;
					if(str[i] < 'Z') {
						tmp = 'Z' - str[i];
						str[i] = ('Z' + 1) - tmp;
					}
				}
			}
		}

		cout << str << endl;
	}
}

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;
  string al="";
  for(char i='a';i<='z';i++)al+=i;
  for(char i='A';i<='Z';i++)al+=i;
  while(cin>>n,n){
    vector<int> a(n);
    string s;
    rep(i,n)cin>>a[i];
    cin>>s;
    rep(i,s.size()){
      int index;
      rep(j,al.size())if(al[j]==s[i])index=j;
      cout<<al[(index-a[i%n]+52)%52];
    }
    cout<<endl;
  }
 return 0;
}

C++: #include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		int a[100];
		for (int i = 0; i < n; i++) cin >> a[i];
		string s, h = "";
		cin >> s;
		int k = 0;
		for (int i = 0; i < s.length(); i++) {
			int e = (int)s[i] - a[k];
			k++;
			if (k >= n) k = 0;
			while ((e > 'Z'&&e < 'a') || e<'A' || e>'z') {
				if (e > 'Z'&&e<'a') {
					e = 'Z' - ('a'-e)+1;
				}
				if (e < 'A') {
					e = 'z' - ('A' - e)+1;
				}
				if (e > 'Z'&&e<'a') {
					e = 'a' + (e - 'Z');
				}
				if (e > 'z') {
					e = 'A' + (e - 'z')-1;
				}
			}
			h += (char)e;
		}
		cout << h << endl;
		h = "";
	}
}

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

int main()
{
	map<int,char> f;
	map<char,int> g;
	for(int i=0;i<26;i++){
		f[i]='A'+i;
		f[26+i]='a'+i;
		g['A'+i]=i;
		g['a'+i]=26+i;
	}
	
	for(int n;cin>>n && n;){
		vector<int> ks(n);
		for(int& k:ks) cin>>k;
		string s; cin>>s;
		for(int i=0;i<s.size();i++){
			int j=g[s[i]];
			j=(j+52-ks[i%n])%52;
			cout<<f[j];
		}
		cout<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  int n;
  char tmp[64] ={"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"};
  while(scanf("%d", &n) && n){
    queue<int> key;
    int k;
    char str[128];
    rep(i, n){
      scanf("%d", &k);
      key.push(k);
    }
    scanf("%s", str);
    //    printf("finish input");
    rep(i, strlen(str)){
      k = key.front(); key.pop();
      int p = str[i]>96?str[i]-71:str[i]-65;
      if(p < k) p += 52 - k;
      else p -= k;
      str[i] = tmp[p];
      key.push(k);
    }
    puts(str);
  }
  return 0;
}

C++: #pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long int;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
map<char,int> ind;
int main(){
  V<char> d(52);
  for(char c='a';c<='z';c++){
    ind[c]=(int)c-'a';
    d[ind[c]]=c;
  }
  int p=26;
  for(char c='A';c<='Z';c++){
    ind[c]=p++;
    d[ind[c]]=c;
  }
  while(1){
    int  n;
    cin>>n;
    if(n==0)return 0;
    V<int> k(n);
    for(int i=0;i<n;i++)cin>>k[i];
    string s;
    cin>>s;
    int m=s.size();
    int id;
    for(int i=0;i<m;i++){
      id=ind[s[i]];
      cout<<d[(id+52-k[i%n])%52];
    }
    cout<<"\n";
  }
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,c=0,k,i;
  string s;
  while(cin>>n,n){
    c=0;
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    cin>>s;
  for(i=0;i<s.size();i++){
    k=a[c++%n];
    for(int j=0;j<k;j++){
    if(int(s[i])-1>90&&int(s[i])-1<97)s[i]=s[i]-7;    
    else if(int(s[i])-1<65)s[i]='{'-1;
    else s[i]=s[i]-1;
    }
  }
  cout<<s<<endl;
  }
}