#include<bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
using namespace std;
const int maxn=2e2+;
const int inf = 0x3f3f3f3f;
vector<int> vs[maxn];
priority_queue<pii> que;
int dis[maxn];
void dij(int s){
memset(dis,inf,sizeof(dis));
que.push(pii(,s));
dis[s] = ;
while(!que.empty()){
int u = que.top().se; que.pop();
for(int i=; i<vs[u].size(); i++)
{
int v = vs[u][i];
if(dis[v] > dis[u] + ) {
dis[v] = dis[u] + ;
que.push(pii(-*dis[v],v));
}
}
}
}
int main()
{
while()
{
int n; cin>>n;
if(!n) break;
int l,r; cin>>l>>r;
for(int i=;i<=n;i++)
{
int x; cin>>x;
if(i-x>=) vs[i].push_back(i-x);
if(i+x<=n) vs[i].push_back(i+x);
}
dij(l);
for(int i=;i<=n;i++)
vs[i].clear();
if(dis[r]!=inf) cout<<dis[r]<<endl;
else cout<<-<<endl;
}
}