import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    }
} Main public static void main(String args[]) {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    } main {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    } final int baseCount = 111; baseCount 111 final int input = new Scanner(System.in).nextInt(); input new Scanner(System.in).nextInt() new Scanner(System.in).nextInt new Scanner(System.in) int result; result if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        } input % baseCount == 0 input % baseCount input baseCount 0 {
            result = input;
        } result = input result input {
            result = (input / baseCount + 1) * baseCount;
        } result = (input / baseCount + 1) * baseCount result (input / baseCount + 1) * baseCount (input / baseCount + 1) input / baseCount input baseCount 1 baseCount System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {
    public static void main(String args[]) {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    }
} public class Main {
    public static void main(String args[]) {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        final int baseCount = 111;
        final int input = new Scanner(System.in).nextInt();
        int result;
        if (input % baseCount == 0) {
            result = input;
        } else {
            result = (input / baseCount + 1) * baseCount;
        }
        System.out.println(result);
    }
}