#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
//英语 看博友分析 抄博友程序 递归 背
int n;
string s;
int dfs(int x)
{
if(x==n||s[x]=='0')
{
return 0;//抄博友程序
}
if(s[x]>='1'&&s[x]<='9')
{
s[x]--;
if((x+s[x]-'0'+1)<n)
{
int y=dfs(x+s[x]-'0'+1);
return y+1;
}else
{
return dfs(x+1)+1;//抄博友程序
}
}else if(s[x]>='A'&&s[x]<='Z')
{
int y=dfs(x+1);
s[x]=(y%10)+'0';//抄博友程序
return y+1;
}
}
int main()
{
while(1)
{
string ts;
cin>>ts;
if(ts=="ENDOFINPUT")
{
break;
}
cin>>n;
cin>>s;
cin>>ts;
dfs(0);
cout<<s<<endl;
}
return 0;
}