import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    }
} import java.util.Scanner; Scanner java.util import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    } main {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc int max = Character.getNumericValue(n.charAt(0)); max Character.getNumericValue(n.charAt(0)) Character.getNumericValue Character n.charAt(0) n.charAt n 0 int sum = 0; sum 0 for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        } int i = 0; int i = 0; i 0 i < n.length() - 1 i n.length() - 1 n.length() n.length n 1 i++ i++ i {
            sum += max;
            sum *= 10;
        } {
            sum += max;
            sum *= 10;
        } sum += max sum max sum *= 10 sum 10 sum += max sum max if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        } Integer.parseInt(n) <= sum Integer.parseInt(n) Integer.parseInt Integer n sum {
            System.out.println(sum);
            return;
        } System.out.println(sum) System.out.println System.out System System.out sum return; max++ max System.out.println(max * 100 + max * 10 + max) System.out.println System.out System System.out max * 100 + max * 10 + max max * 100 + max * 10 + max max * 100 max 100 max * 10 max 10 max String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    }
} Main
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int max = Character.getNumericValue(n.charAt(0));
        int sum = 0;
        for (int i = 0; i < n.length() - 1; i++) {
            sum += max;
            sum *= 10;
        }
        sum += max;
        if (Integer.parseInt(n) <= sum) {
            System.out.println(sum);
            return;
        }
        max++;
        System.out.println(max * 100 + max * 10 + max);
    }
}
