import java.util.*;
public class Main{

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     }
} import java.util.*; util.* java public class Main{

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     }
} Main public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     } main {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        } n/100 != n%100/10 || n/100 != n%10 n/100 != n%100/10 n/100 n 100 n%100/10 n%100 n 100 10 n/100 != n%10 n/100 n 100 n%10 n 10 {
            n++;
        } n++ n System.out.print(n) System.out.print System.out System System.out n String []args args public class Main{

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     }
} public class Main{

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     }
} Main
import java.util.*;
public class Main{

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n/100 != n%100/10 || n/100 != n%10){
            n++;
        }
        System.out.print(n);
     }
}