import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    } main {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        } in.hasNext() in.hasNext in {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        } int n = in.nextInt(); n in.nextInt() in.nextInt in int[] a = new int[3]; a new int[3] 3 a[0] = n / 100 a[0] a 0 n / 100 n 100 a[1] = n % 100 a[1] a 1 n % 100 n 100 a[2] = a[1] % 10 a[2] a 2 a[1] % 10 a[1] a 1 10 a[1] = a[1] / 10 a[1] a 1 a[1] / 10 a[1] a 1 10 int m; m if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            } a[0] == a[1] && a[0] == a[2] a[0] == a[1] a[0] a 0 a[1] a 1 a[0] == a[2] a[0] a 0 a[2] a 2 {
                System.out.println(n);
            } System.out.println(n) System.out.println System.out System System.out n {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            } if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                } a[0] < a[1] a[0] a 0 a[1] a 1 {
                    m = a[0] + 1;
                } m = a[0] + 1 m a[0] + 1 a[0] a 0 1 if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                } a[0] > a[1] a[0] a 0 a[1] a 1 {
                    m = a[0];
                } m = a[0] m a[0] a 0 {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                } if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    } a[0] > a[2] a[0] a 0 a[2] a 2 {
                        m = a[0];
                    } m = a[0] m a[0] a 0 {
                        m = a[0] + 1;
                    } m = a[0] + 1 m a[0] + 1 a[0] a 0 1 System.out.println(m * 100 + m * 10 + m) System.out.println System.out System System.out m * 100 + m * 10 + m m * 100 + m * 10 + m m * 100 m 100 m * 10 m 10 m String[] args args public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    }
} public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = in.nextInt();

            int[] a = new int[3];
            a[0] = n / 100;
            a[1] = n % 100;
            a[2] = a[1] % 10;
            a[1] = a[1] / 10;

            int m;
            if (a[0] == a[1] && a[0] == a[2]) {
                System.out.println(n);
            } else {
                if (a[0] < a[1]) {
                    m = a[0] + 1;
                } else if (a[0] > a[1]) {
                    m = a[0];
                } else {
                    if(a[0] > a[2]){
                        m = a[0];
                    }else{
                        m = a[0] + 1;
                    }
                }
                System.out.println(m * 100 + m * 10 + m);
            }
        }
    }
}