7up

Problem Description

7-UP is a game that can be played by a group of N children, standing in a circle. Starting from 1, the children take turns shouting the natural numbers in increasing order, going around the circle. For example, in a group of 9 children, the second child will shout 2, 11, 20, 29, and so on. This will go on for exactly K rounds, before the children get tired and stop playing.

However, there is a small catch. If the number that a child is supposed to shout out is a multiple of 7 or contains the digit 7, the child would shout "UP!" in place of the number. So, for example, if a child was supposed to shout 17, he would shout "UP!", as 17 contains the digit 7.

You are the Xth child in a circle with N children. Print out exactly K lines, detailing what you are supposed to shout during each round of the game.

Input

The input will contain one line with exactly three integers, N, K and X.

Output

The output should contain K lines, with each line containing either an integer or the string "UP!".

Limits

For all subtasks: 1 ≤ N, K ≤ 1000, 1 ≤ X ≤ N.

Subtask 1 (13%): N = X = 7.

Subtask 2 (10%): N = X = 1, 1 ≤ K ≤ 10.

Subtask 3 (15%): N = X = 1, 1 ≤ K ≤ 100.

Subtask 4 (22%): N = X = 1.

Subtask 5 (40%): No additional constraints.

Sample Input

9 10 2

Sample Output

2
11
20
29
38
UP!
UP!
65
UP!
83

Time Limit: 1 Seconds
Memory Limit: 256MB
Your best score: 0
Source: RI November Course Stage 2 Selection Test 2019
Editorial: 1

Subtask Score
1 13
2 10
3 15
4 22
5 40
6 0