import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int a = N/100; a N/100 N 100 int b = a*100+a*10+a; b a*100+a*10+a a*100+a*10+a a*100 a 100 a*10 a 10 a if(N <= b)    System.out.println(b);
        else System.out.println(b+111); N <= b N b System.out.println(b) System.out.println System.out System System.out b System.out.println(b+111) System.out.println System.out System System.out b+111 b 111 String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N/100;
        int b = a*100+a*10+a;
        if(N <= b)    System.out.println(b);
        else System.out.println(b+111);
    }
}