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 pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

vi encode(string s) {
  vi res(SZ(s));
  REP(i, SZ(s)) {
    if('a' <= s[i] && s[i] <= 'z') {
      res[i] = s[i] - 'a';
    } else {
      res[i] = s[i] - 'A' + 26;
    }
  }
  return res;
}

string decode(const vi &a) {
  string s = "";
  REP(i, SZ(a)) {
    if(0 <= a[i] && a[i] <= 25) {
      s += a[i] + 'a';
    } else {
      s += a[i] - 26 + 'A';
    }
  }
  return s;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    vi k(n);
    REP(i, n) cin >> k[i];
    string s; cin >> s;
    vi a = encode(s);
    REP(i, SZ(a)) {
      a[i] = ((a[i] - k[i%SZ(k)]) + 52) % 52;
    }
    cout << decode(a) << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  int *k,i;
  char *s;
while(1){
  int n;
  s=new char[100];
  cin>>n;
  if(n==0)break;
  k= new int[n+1];
  for(i=1;i<=n;i++)cin>>k[i];
  cin>>s;
  for(i=0;s[i]!=0;i++){
    s[i]-=k[i%n+1];
    if(s[i]<'A')s[i]-='A'-'z'-1;
    else if(s[i]>'Z' && s[i]<'a')s[i]-=6;
  }
  cout<<s<<endl;

  delete s;
  delete k;
}

return 0;
}

C++: #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void Solve(int n){
  std::vector<int> key(n);
  for(int i=0;i<n;i++){
    cin>>key[i];
  }
  std::string s;
  cin>>s;
  std::string result;
  int key_itr=0;
  for(int i=0;i<s.size();i++){
    char target=s[i];
    if(target<='Z'){
      target-=key[key_itr];
      if(target<'A'){
        target+=58;
      }
    }else{
      target-=key[key_itr];
      if(target<'a'){
        target-=6;
      }
    }
    result+=target;
    key_itr++;
    if(key_itr>=n){
      key_itr=0;
    }
  }
  cout<<result<<endl;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while(1){
    int n;
    cin>>n;
    if(n==0){
      return 0;
    }else{
      Solve(n);
    }
  }


  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int *k,count;
  char *s;
while(1){
  int n,i;
  s=new char[100];
  cin>>n;
  if(n==0)break;
  count=1;
  k= new int[n+1];
  for(i=1;i<=n;i++)cin>>k[i];
  cin>>s;
  for(i=0;s[i]!=0;i++){
    s[i]-=k[count>n?count=0:count++];
    if(s[i]<'A')s[i]='z'-('A'-s[i]);
  }
  cout<<s<<endl;

  delete s;
  delete k;
}
return 0;
}