import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    } main {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc int m = Integer.parseInt(n); m Integer.parseInt(n) Integer.parseInt Integer n int a = Character.getNumericValue(n.charAt(0)); a Character.getNumericValue(n.charAt(0)) Character.getNumericValue Character n.charAt(0) n.charAt n 0 if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        } a * 111 >= m a * 111 a 111 m {
            System.out.println(a * 111);
        } System.out.println(a * 111) System.out.println System.out System System.out a * 111 a 111 {
            System.out.println((a + 1) * 111);
        } System.out.println((a + 1) * 111) System.out.println System.out System System.out (a + 1) * 111 (a + 1) a 1 111 String[] args args public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    }
} public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        String n = sc.next();

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    }
}
