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