C - Go Further Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 8

問題文

数字と英小文字の変数からなる単項式が 良い単項式 であるとは、英小文字 1 文字の変数の左に 1 以上 999 以下の整数が係数として掛けられているような式を指します。ただし、係数が 1 であっても、良い単項式ではそれを省略せずに書くものとします。
例えば、 123a1z は良い単項式ですが、 0a1000b12312aba123a などは良い単項式ではありません。

さらに、良い単項式の変数に

  • a=1000
  • b=1000a
  • \dots
  • z=1000y

で定まる値を代入したときの値をその良い単項式の値とします。
例えば、 123a の値は 12300020b の値は 200000001c の値は 1000000000 となります。

良い単項式の値としてあり得るもののうち、 \alpha 以下で最大のものを良い単項式の形で出力してください。
なお、この問題の制約下でそのようなものは必ず一意に存在することが証明できます。

制約

  • 1000 \le \alpha < 10^{81}
  • \alpha は整数

入力

入力は以下の形式で標準入力から与えられる。

\alpha

出力

問題文中の指示に従って出力せよ。


入力例 1

123456789

出力例 1

123b

123b = 123000000 であり、この値は \alpha = 123456789 以下の良い単項式の値のうち最大です。


入力例 2

77777

出力例 2

77a

入力例 3

9982443539982448531000000007

出力例 3

9i

入力が 64bit 整数に収まらない場合もあります。

Score : 8 points

Problem Statement

A monomial consisting of a number and an English lowercase variable is said to be a good monomial if an English lowercase single-letter variable is multiplied from the left by an integer coefficient between 1 and 999 (inclusive). Here, we assume that the coefficient in a good monomial is never omitted even if the coefficient is 1.
For example, 123a and 1z are good monomials, while 0a, 1000b, 123, 12ab, a123, and a are not.

Next, let us define the value of a good monomial by the value when certain values are assigned to the monomial. Specifically, the value for each variable to be assigned is determined by the following equations:

  • a=1000
  • b=1000a
  • \dots
  • z=1000y

For instance, the value of 123a is 123000, the value of 20b is 20000000, and the value of 1c is 1000000000.

Among the possible values of good monomials, print the maximum one not exceeding \alpha in the form of a good monomial.
We can prove that such monomial always uniquely exists under the Constraints of this problem.

Constraints

  • 1000 \le \alpha < 10^{81}
  • \alpha is an integer.

Input

Input is given from Standard Input in the following format:

\alpha

Output

Print the answer according to the instruction in the Problem Statement.


Sample Input 1

123456789

Sample Output 1

123b

We have 123b = 123000000, which is the maximum possible value of a good monomial not exceeding \alpha = 123456789.


Sample Input 2

77777

Sample Output 2

77a

Sample Input 3

9982443539982448531000000007

Sample Output 3

9i

The input may not fit into 64-bit integer type.