#!/usr/bin/perl

use v5.30;
use strict;


my $pc = 0;
chomp (my @offs = <>);

my $steps = 0;
while ($pc >= 0 && $pc < @offs) {
	say "$steps $pc $offs[$pc]";
	$pc += $offs[$pc]++;
	$steps++;
}

say $steps;
