Under construction

Still being built. Things may change

Forbidden Zero

Interview

Time limit1sMemory limit512 MB

Summary
Given a positive integer n with no digit 0, find the next integer in increasing order that also contains no digit 0.
Level

Medium4 of 10

Topics
Math, Implementation, Brute force, Simulation
Solved
No attempts yet

Problem

You are writing the positive integers in increasing order, starting from 1. You have never learned the digit 0, so you skip every number that contains a 0 in any position. The first ten integers you write are 1, 2, 3, 4, 5, 6, 7, 8, 9, and 11.

You have just written the integer nn, which contains no digit 0. Find the next integer you will write.

Input

The first line contains the integer nn (1≤n≤9999991 \le n \le 999999).

The integer nn contains no digit 0.

Output

Print the next integer you will write on the first line.

Examples2

  1. Example 1

    Input
    99
    
    Expected output
    111
    
  2. Example 2

    Input
    1234
    
    Expected output
    1235