Removing substrings#8795

Removing substrings

1 second
64 megabytes
Hard

Given a string consisting of lowercase Latin letters, you need to perform operations on it, where k = \lfloor \log_2 n \rfloor. In the -th operation, you must remove a substring of length exactly 2^{i-1} from .

Your task is to output the lexicographically smallest string possible after completing all the operations.

Input

The input consists of a single line containing the string , which has lowercase Latin characters, where 1 \le n \le 5000.

Output

Print the lexicographically smallest string that can be obtained after performing all operations.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading