Battle of Nieuwpoort
시간 제한1초메모리 제한1024 MB
주어진 연도를 2에서 16 사이의 진법으로 나타냈을 때 끝이 정확히 00이 되고 첫 자리가 0이 아닌 진법을 찾는다.
문제
The battle of Nieuwpoort occurred in the year . This is famously easy to remember, because it ends in two zeros. Alas, not all historical events have been so obliging!
You suspect that the problem is with the fixation of historians on the decimal system. Maybe, given the year of another battle, there exists a small base (at most ) in which this year would also be easy to remember?
입력
The input consists of:
-
One line with tokens:
- One integer (, in base-), the year of the battle.
- Three words (), naming the battle. The words only consist of English letters (
A-Zanda-z).
출력
If it is possible to rewrite the year to make it easier to remember, output this base (, in base-) and the year written in base-. Otherwise, output "impossible".
The year in base- must end with "00" and must not start with '0'.
Use letters 'a', 'b', 'c', etc. for the digits following '9' in bases higher than .
If there are multiple valid solutions, you may output any one of them.