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
//------------------------------------------
#include <bits/stdc++.h> // only for GCC

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

//repetition
//------------------------------------------
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T>ostream&operator<<(ostream&os, vector<T>const&v){
        iter(it,v) os<<*it<<(it+1==v.end()?"":",");
        return os;
    }
    template<typename T, typename U>ostream&operator<<(ostream&os,const pair<T,U>&p){
        return os << "[" << p.dirst << "," << p.second << "]";
    }
}

//clear memory
// ------------------------------------------
#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
   int n;
   while(cin >> n && n){
      vi a(n);
      rep(i,n) cin >> a[i];
      string s;
      cin >> s;
      rep(i,s.size()){
         s[i]-=a[i%a.size()];
         if(s[i]<'A') s[i]='z'-('A'-s[i])+1;
         if(s[i]<'a'&&s[i]>'Z') s[i]='Z'-('a'-s[i])+1;
      }
      cout << s << endl;
   }
}

C++: #include <cstdio>
#include <iostream>
#include <string.h>

using namespace std;

int num[108];

void decode(int l, int k[108], char s[108], char alph[56])
{	
	for(int i = 1; i <= l; i++){
		if(s[i - 1] >= 'a' && s[i - 1] <= 'z'){
			num[i] = s[i - 1] - 'a';
		}
		else{
			num[i] = s[i - 1] - 'A' + 26;
		}
		if(num[i] - k[i] < 0){
			while(num[i] - k[i] < 0){
				num[i] += 52 - k[i];
			}
		}
		else{
			num[i] -= k[i];
		}
		cout << alph[num[i]];
	}
	puts("");
}


int main()
{
	int n, m, l;
	int k[108];
	char s[108];
	char alph[56];
	
	for(int i = 0; i < 26; i++){
		alph[i] = 'a' + i;
	}
	for(int i = 0; i < 26; i++){
		alph[i + 26] = 'A' + i;
	}

	
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = 1; i <= n; i++){
			cin >> k[i];
		}
		cin >> s;
		
		m = n;
		l = strlen(s);
		while(l > m){
			for(int i = 1; i <= n; i++){
				k[m + i] = k[i];
			}
			m += n;
		}
		decode(l, k, s, alph);
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <map>
#include <set>

using namespace std;


int S,N,T;
string wkd,time;
int P,M;
map<string,int> m;
int wkdNum;
int timeInfo;

bool isChange(int sweek,int stime){
  bool change=false;
  if(wkdNum==7||sweek==wkdNum){
    if(timeInfo==0)change=true;
    else if(timeInfo==1){
      if(stime>=6*60&&stime<18*60)change=true;
    }
    else{
      if(stime>=18*60||stime<6*60)change=true;
    }
  }
  return change;
}

double simu(int sweek,int stime){
  double res=0;
  int nowTime=stime;
  int nowWeek=sweek;
  int cnt=0;
  for(int i=0;i<M;i++){
    bool change=isChange(nowWeek,nowTime);
    bool ok=false;
    for(int j=1;j<=T;j++){
      nowTime=nowTime+1;
      // timeをすすめる
      if(nowTime>=24*60){
        nowTime=0;
        nowWeek=(nowWeek+1)%7;
      }
      change&=isChange(nowWeek,nowTime);
      if(j==S){
        if(change){
          ok=true;
        }
      }
    }
    // okがtrueなら、計算
    if(ok)cnt++;
  }
  double a=1.0/P;
  double b=(1-pow((1-a),N));
  res=(1-pow((1-b),cnt));
  return res;
}

int main(){

  m["Sun"]=0;
  m["Mon"]=1;
  m["Tue"]=2;
  m["Wed"]=3;
  m["Thu"]=4;
  m["Fri"]=5;
  m["Sat"]=6;
  while(cin>>S>>N>>T>>wkd>>time>>P>>M&&N){
    if(wkd=="All")wkdNum=7;
    else wkdNum=m[wkd];
    if(time=="All")timeInfo=0;
    else if(time=="Day")timeInfo=1;
    else timeInfo=2;
    double res=0;
    // 開始設定
    for(int i=0;i<7;i++){
      for(int j=0;j<60*24;j++){
        // この設定でsimulate
        res=max(res,simu(i,j));
      }
    }
    printf("%.10f\n",res);
  }
  
  
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <memory>
#include <cstring>
#include <cassert>
#include <numeric>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define REP2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(S) (S).begin(), (S).end()
typedef long long ll;

char return_prev(char c){
  if (c == 'a') return 'Z';
  if (c == 'A') return 'z';
  return c - 1;
}

                 
int main(){
  ios::sync_with_stdio(false);

  int n;
  while (cin >> n && n > 0){
    vector<int> keys(n);
    REP(i, n) cin >> keys[i];
    string s;
    cin >> s;
    int m = s.size();

    REP(i, m){
      int k = keys[i % n];
      REP(j, k) s[i] = return_prev(s[i]);
    }
    cout << s << endl;
  }
  return 0;
}