There are $$$n$$$ dogs all facing clockwise in a circle with $$$n$$$ evenly spaced points. They are all feeling energetic and want to chase the dog in front of them by running over $$$v_i$$$ points. Sometimes, this causes them to miss their target. Being a dog photographer, you want to find the earliest time $$$t$$$ and position $$$p$$$ that the dogs will all be at one point, such that you can take a picture of all of the dogs together. Of course, you have limited time to take the photos, so at $$$t = 1001$$$, you will decide to take pictures of other groups of dogs and leave.
The first integer will contain $$$n (1\leq n\leq 1000)$$$. The next lines will each contain $$$n$$$ integers $$$v_i (1\leq v_i \leq 100, 0\leq i\leq n - 1)$$$, where the $$$i$$$-th dog starts at position $$$i$$$ at $$$t = 0$$$.
Two space-separated integers, the earliest time $$$t$$$ and position $$$p$$$. If all the dogs cannot be at one point, print $$$-1$$$
3 1 2 3
2 2