aoc2017day05
import sys
def day5(input):
maze = list(map(lambda x: int(x.rstrip()), input.split()))
size = len(maze)
steps = 0
pc = 0
while pc >= 0 and pc < size:
offset = maze[pc]
maze[pc] += 1
pc += offset
steps += 1
return "%d" % steps
input = sys.stdin.read()
print(day5(input))
INFO