import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static int createNumber(int x){
        int n = (x*10 + x) * 10 + x;
        return n;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    }
    
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main {

    public static int createNumber(int x){
        int n = (x*10 + x) * 10 + x;
        return n;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    }
    
} Main public static int createNumber(int x){
        int n = (x*10 + x) * 10 + x;
        return n;
    } createNumber {
        int n = (x*10 + x) * 10 + x;
        return n;
    } int n = (x*10 + x) * 10 + x; n (x*10 + x) * 10 + x (x*10 + x) * 10 (x*10 + x) x*10 x 10 x 10 x return n; n int x x public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    } main {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    } Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) int n = in.nextInt(); n in.nextInt() in.nextInt in if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        } n > 999 n 999 {
            System.out.println(1111);
        } System.out.println(1111) System.out.println System.out System System.out 1111 {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        } int first = (n /10) /10; first (n /10) /10 (n /10) n 10 10 if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1)); n <= createNumber(first) n createNumber(first) createNumber first System.out.println(createNumber(first)) System.out.println System.out System System.out createNumber(first) createNumber first System.out.println(createNumber(first+1)) System.out.println System.out System System.out createNumber(first+1) createNumber first+1 first 1 String[] args args public class Main {

    public static int createNumber(int x){
        int n = (x*10 + x) * 10 + x;
        return n;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    }
    
} public class Main {

    public static int createNumber(int x){
        int n = (x*10 + x) * 10 + x;
        return n;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    }
    
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static int createNumber(int x){
        int n = (x*10 + x) * 10 + x;
        return n;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        if (n > 999){
            System.out.println(1111);
        }
        else {
            int first = (n /10) /10;
            if (n <= createNumber(first))
                System.out.println(createNumber(first));
            else System.out.println(createNumber(first+1));
        }
    }
    
}