Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Think Inside the Box

By ashikurrahman · Limits 1s, 512 MB · Custom Checker

Babu Bhai (:p) is a student of AUST. He has some favorite numbers. His favorite numbers are those number that has only one distinct digit. Example: 7, 88, 222, 9999, etc. 123, 122, 33344 are not his favorite numbers. Now, you are given an positive integer N. You have to find a positive favorite number for Babu Bhai not greater that N.

Input

A single integer N. 1 <= N <= 1000.

Output

A single integer M(Favorite Number of Babu Bhai). (1 <= M <= N)

If there is multiple possible solution print any of them. It is guarented that for the given N solution always exists.

Samples

InputOutput
100
99

88, 77, 66… are also acceptable.

InputOutput
99
99


    Discussion

    Statistics


    99% Solution Ratio

    rahat_chyEarliest, 1M ago

    rahat_chyFastest, 0.0s

    rahat_chyLightest, 0 B

    steinumShortest, 8B

    Submit

    Login to submit