import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
static  Scanner sc = new Scanner(System.in);


public static void main(String[] args) {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

}

}

 import java.io.*; io.* java import java.util.*; util.* java import java.math.BigInteger; BigInteger java.math public class Main {
static  Scanner sc = new Scanner(System.in);


public static void main(String[] args) {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

}

} Main static  Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

} main {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

} int N ; N String tr=sc.nextLine(); tr sc.nextLine() sc.nextLine sc N=Integer.parseInt(tr) N Integer.parseInt(tr) Integer.parseInt Integer tr while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
} true {
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
} String s=""; s "" s=(N+"") s (N+"") N "" HashSet<String> list=new HashSet<>(); list new HashSet<>() String[] temp=s.split(""); temp s.split("") s.split s "" for(String t:temp)list.add(t); String t temp list.add(t); list.add(t) list.add list t if(list.size()==1){
System.out.println(s);
break;
} list.size()==1 list.size() list.size list 1 {
System.out.println(s);
break;
} System.out.println(s) System.out.println System.out System System.out s break; N++ N String[] args args public class Main {
static  Scanner sc = new Scanner(System.in);


public static void main(String[] args) {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

}

} public class Main {
static  Scanner sc = new Scanner(System.in);


public static void main(String[] args) {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

}

} Main
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
static  Scanner sc = new Scanner(System.in);


public static void main(String[] args) {
int N ; 
String tr=sc.nextLine();
N=Integer.parseInt(tr);

while(true){
String s="";
s=(N+"");
HashSet<String> list=new HashSet<>();
String[] temp=s.split("");
for(String t:temp)list.add(t);
if(list.size()==1){
System.out.println(s);
break;
}
//System.out.println(N);
N++;
}

}

}


