import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    }
} Main public static void main(String[] args) {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    } main {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    } int i = new Scanner(System.in).nextInt(); i new Scanner(System.in).nextInt() new Scanner(System.in).nextInt new Scanner(System.in) System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111) System.out.println System.out System System.out i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111 i / 100 * 111 >= i i / 100 * 111 i / 100 i 100 111 i i / 100 * 111 i / 100 i 100 111 (i / 100 + 1) * 111 (i / 100 + 1) i / 100 i 100 1 111 String[] args args public class Main {
    public static void main(String[] args) {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    }
} public class Main {
    public static void main(String[] args) {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int i = new Scanner(System.in).nextInt();
        System.out.println(i / 100 * 111 >= i ? i / 100 * 111 : (i / 100 + 1) * 111);
    }
}