In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (irc.pirc.pl
) in #szkopul
channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
Famous stones Xi can only be found in Wonderland. Such a stone is simply a granite board with an inscription consisting only of letters X and I. Each board contains exactly letters. There are not more than positions in each board where letters X and I are next to each other.
The top and bottom sides of the stones are not fixed, so the stones can be rotated upsidedown. For instance two figures below depict exactly the same stone:


No two magic stones in Wonderland are the same, i.e. no two stones contain the same inscription (remember that the upsidedown rotation of a stone is allowed).
If it is possible to read the inscription of some stone in two different ways (using the upsidedown rotation) then the canonical representation of the stone is defined as the lexicographically less of these two ways of reading the inscription. We say that inscription is lexicographically less than (assuming that lengths of and are the same) if contains letter I and contains letter X at the first position where the inscriptions differ.
If a stone's inscription is symmetrical, i.e. the upsidedown rotation does not change it, then its canonical representation is defined as the unique way of reading this inscription.
There are exactly 6 stones of type Xi32. Their canonical representations written in lexicographical order are: III, IIX, IXI, IXX, XIX and XXX.
Alice is a wellknown expert on the Xi stones from Wonderland. She would like to create a lexicographical index of the canonical representations of all stones of type Xi (for some specific values of and ). What inscription should be written at position of the index, for a given value of ?
Write a programme which:
The first and only line of the standard input contains three integers , and (, ) separated by single spaces.
The first and only line of the standard output should contain the th (in the lexicographical order) canonical representation of a Xi stone.
If the number of Xi stones is less than then the first and only line of output should contain expression NO SUCH STONE.
For the input data:
3 2 5
the correct result is:
XIX
and for the input data:
3 2 7
the correct result is:
NO SUCH STONE
Task authors: Pawel Parys, Szymon Acedanski.