import java.util.Scanner;

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

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

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

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int digit_100 = N / 100; digit_100 N / 100 N 100 int digit_10 = (N / 10) % 10; digit_10 (N / 10) % 10 (N / 10) N 10 10 int digit_1 = N % 10; digit_1 N % 10 N 10 int ans = 0; ans 0 if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        } digit_100 >= digit_10 && digit_100 >= digit_1 digit_100 >= digit_10 digit_100 digit_10 digit_100 >= digit_1 digit_100 digit_1 {
            ans = 111*digit_100;
        } ans = 111*digit_100 ans 111*digit_100 111 digit_100 {
            ans = 111*(digit_100+1);
        } ans = 111*(digit_100+1) ans 111*(digit_100+1) 111 (digit_100+1) digit_100 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

    }
} Main
import java.util.Scanner;

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

        int digit_100 = N / 100;
        int digit_10 = (N / 10) % 10;
        int digit_1 = N % 10;

        int ans = 0;
        if (digit_100 >= digit_10 && digit_100 >= digit_1) {
            ans = 111*digit_100;
        } else  {
            ans = 111*(digit_100+1);
        }

        System.out.println(ans);

    }
}