import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = a / 100; b a / 100 a 100 String c = Integer.toString(b); c Integer.toString(b) Integer.toString Integer b String d = c + c + c; d c + c + c c + c + c c c c if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        } a - Integer.parseInt(d) > 0 a - Integer.parseInt(d) a Integer.parseInt(d) Integer.parseInt Integer d 0 {
            System.out.println(Integer.parseInt(d) + 111);
        } System.out.println(Integer.parseInt(d) + 111) System.out.println System.out System System.out Integer.parseInt(d) + 111 Integer.parseInt(d) Integer.parseInt Integer d 111 {
            System.out.println(d);
        } System.out.println(d) System.out.println System.out System System.out d String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = a / 100;
        String c = Integer.toString(b);
        String d = c + c + c;
        if (a - Integer.parseInt(d) > 0) {
            System.out.println(Integer.parseInt(d) + 111);
        } else {
            System.out.println(d);
        }
    }
}
