import java.util.*;
public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     }
} import java.util.*; util.* java public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     }
} Main public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     } main {
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     } Scanner x=new Scanner(System.in); x new Scanner(System.in) int a=x.nextInt(); a x.nextInt() x.nextInt x while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        } 100<=a&&a<=999 100<=a 100 a a<=999 a 999 {
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        } int b=a/100; b a/100 a 100 int c=a%100/10; c a%100/10 a%100 a 100 10 int d=a%100%10/1; d a%100%10/1 a%100%10 a%100%10 a 100 10 1 int bb=(b*100)+(b*10)+b; bb (b*100)+(b*10)+b (b*100)+(b*10)+b (b*100) b 100 (b*10) b 10 b if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            } bb>=a bb a {
                System.out.println(bb);
                break;
            } System.out.println(bb) System.out.println System.out System System.out bb break; {
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            } System.out.println((b+1)*100+(b+1)*10+(b+1)) System.out.println System.out System System.out (b+1)*100+(b+1)*10+(b+1) (b+1)*100+(b+1)*10+(b+1) (b+1)*100 (b+1) b 1 100 (b+1)*10 (b+1) b 1 10 (b+1) b 1 break; String []args args public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     }
} public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     }
} Main
import java.util.*;
public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        while(100<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            int bb=(b*100)+(b*10)+b;
            if(bb>=a){
                System.out.println(bb);
                break;
            }
            else{
                System.out.println((b+1)*100+(b+1)*10+(b+1));
                break;
            }
        }
     }
}