LearnPy Hub
← Arena
EasyRating 1000

Rotate and Ask

Rotate the list right by k positions, then answer q questions: what is at position p (counting from 0)?

Input

n, k, q; then n integers; then q positions, one per line.

Output

q lines.

Sample 1

Input
3 2 3
1 2 3
0
1
2
Output
2
3
1

Sample 2

Input
1 5 1
9
0
Output
9
solution.py
Output appears here
Rotate and Ask · Python Arena problem · LearnPy Hub