Franziska Fellin 1B, Maximilian Auer 4CP, Dr. Romeo Rizzi

Programmierkurs als Vorbereitung auf die territoriale Ausscheidung an der TFO „Max Valier“ Bozen.

Es wurden vier Aufgabenstellungen der „CROATIAN OPEN COMPETITION IN INFORMATICS“ http://hsin.hr/coci/ herausgenommen. Unsere zwei Olympioniken Franziska Fellin aus der Klasse 1B und Maximilian Auer aus der Klasse 4CP haben mit Unterstützung von Dr. Romeo Rizzi versucht einen Lösungsweg für die zwei ersten Aufgaben zu finden, welcher die Aufgabe mit deren Nebenbedingungen erfüllt.

Aufgabe 1: (time limit 1 sec, memory limit 32MB, score 50)

One morning, completely by chance, Mirko found a positive integer N in the middle of the street. Since Mirko adores the number 30, he wants to know the maximum multiple of the number 30 that can be obtained by shuffling the digits of the number he found in the street.

Help our hero and write a programmer that clculates that number (if is exist).

Input:

The first and only line of input contains the integer N, consisting of at most digits.

Output:

The first and only line of output must contain the required number from the task, if it exists. If it doesn't exist, output -1.

Sample test data:

Input

30

Output

30

Input

102

Output

210

Input

2931

Output

-1

Aufgabe 2: (time limit 1 sec, memory limit 32MB, score 80)

Our heroes, Mirko and Slavko, plant Chistmas wheat every year on Saint Lucy's Day. It is well known that stalks of wheat grow at different speeda so, after a certain time, the wheat becomes quite messy. The guys are determined to solve this problem by playing the following game:

When it's Mirko's turn, he chooses a stalk of wheat with the minimal height and prolongs its height so it's of the same height as the firdt stalk longer than it.

When it's Slavko's turn, he schooses a stalk of wheat with the maximal height and cuts it to be of the same height as the first stalk shorter than it.

The game lasts while there are at least three stalks of different heights and the loser is the player who can't make his move.

For given heights of all stalks of wheat and the assumption that Mirko is the one starting the game, determine the winner of the game and the height of the shortest and longest stalk when the game is finished.

Input:

The first line of input contains the integer , the number of wheat stalks. The second line of input contains N space separated integers that denote the heights of individual wheat stalks. The height of each stalk will be less than or equal to .

Output:

The first line of output must contain the word „Mrko“ if _Mirko is the winner of the games, or „Slavko“ is Slavko is the winner of the game. The second of output must contain the height of the shortest and longest stalk when the game is finished.

Scoring:

In test cases worth 50% of total points, it will hold .

In test cases worth 80% of total points, it will hold .

Sample test data:

Input

3

3 3 3

Output

Slavko

3 3

Input

4

3 1 2 1

Output

Slavko

1 2

Input

7

2 1 3 3 5 4 1

Output

Slavko

2 3

Clarification of the first example:

Mirko can’t make his move because there are no three stalks of different heights. Therefore, Slavko is the winner

Termine