Fixed points

Let S=x1,,xnS = x_1, \dots, x_n be a sequence of integer numbers such that x1<<xnx_1 < \dots < x_n. For every integer number aa and every index 1in1 \le i \le n, define fa(i)=xi+af_a(i) = x_i + a. Write a program that, given SS and aa, tells whether there is some ii such that fa(i)=if_a(i) = i.

Input

Input consists of several cases. Every case begins with nn, followed by SS, followed by a number mm, followed by mm different integer numbers a1,,ama_1, \dots, a_m. Assume 1n1061 \le n \le 10^6.

Output

For every case, print its number starting at 1. Afterwards, for every aja_j print the position of its fixed point. If no fixed point exists, state so. If there is more than one fixed point, print the smallest one. Print a blank line after the output for every case.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:22:29.729Z

© Jutge.org, 2006–2026.
https://jutge.org