#OJ1297. Beautiful Year

Beautiful Year

Beautiful Year

Time Limit: 1 Sec  Memory Limit: 128 MB

Description

2013是1987年之后第一个Beautiful Year,也就是说2013由四个不同的数字构成,现在你的任务是,给你一个数字y,请你写出第一个严格大于y的第一个数字,并且它由不同的数字组成。

Input

输入为多组数据,每组一个整数y(1000<=y<=9000)。

Output

每组输出占一行,为大于y的第一个Beautiful Year

Sample Input

2013

Sample Output

2014

HINT