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 <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int main(){
    int n,K[105],c;
    string s;
    while(1){
        cin>>n;
        if(n==0) break;
        Mset(K,0);
        LP(i,n) cin>>K[i];
        cin>>s;
        c=0;
        LP(i,s.size()){
            if(c==n) c=0;
            if(s[i]-K[c]<'a'&&s[i]>='a') cout<<(char)('Z'-(K[c]-(s[i]-'a'))+1);
            else if(s[i]-K[c]<'A'&&s[i]<='Z') cout<<(char)('z'-(K[c]-(s[i]-'A'))+1);
            else cout<<(char)(s[i]-K[c]);
            c++;
        }
        cout<<endl;
    }
    return 0;
}

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

int main(){
  while(1){
    int n;
    cin>>n;
    int a;
    if(n==0)break;
    vector<int> k(n);
    string s;
    for(int i=0;i<n;i++)cin>>k[i];
    cin>>s;
    for(int i=0;i<s.size();i++){
      if(k[i%n]<=26){
        a=s[i]-k[i%n];
        if(a<'A'&&s[i]>='A'&&s[i]<='Z'){
           a+='z'-'A'+1;
         }else if(a<'a'&&s[i]>='a'&&s[i]<='z')a-='a'-'Z'-1;
      }else{
        a=s[i]+(52-k[i%n]);
        if(a>'z'&&s[i]>='z'&&s[i]>='a'){
          a-='z'-'A'+1;
        }else if(a>'Z'&&s[i]<='Z'&&s[i]>='A')a+='a'-'Z'-1;
      }
      putchar(a);
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
 
#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
 
using namespace std;
 
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const char LIST[53] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"};

int main(void){
    string str;
    for(int n; cin >> n, n; cout << str << endl){
        vi ope(n);
        rep(i, n) cin >> ope[i];
        cin >> str;

        rep(i, str.size()){
            int diff = ((str[i] <= 'Z') ? str[i] - 'A':str[i] - 'a' + 26) - ope[i % n];
            str[i] = LIST[(0 <= diff) ? diff:diff + 52];
        }
    }
 
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
using namespace std;
int main(){
  bool l, n, b, s;
  char str[512];
  scanf("%s", str);
  l = n = b = s = false;
  if(strlen(str) >= 6) l = true;
  rep(i, strlen(str)){
    if(str[i] >= '0' && str[i] <= '9') n = true;
    else if(str[i] >= 'A' && str[i] <= 'Z') b = true;
    else if(str[i] >= 'a' && str[i] <= 'z') s = true;
  }
  puts(l&&n&&b&&s?"VALID":"INVALID");
  return 0;
}