import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc System.out.println(solve(N)) System.out.println System.out System System.out solve(N) solve N sc.close() sc.close sc String[] args args static int solve(int N) {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    } solve {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    } int result = N; result N while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        } String.valueOf(result).chars().distinct().count() != 1 String.valueOf(result).chars().distinct().count() String.valueOf(result).chars().distinct().count String.valueOf(result).chars().distinct() String.valueOf(result).chars().distinct String.valueOf(result).chars() String.valueOf(result).chars String.valueOf(result) String.valueOf String result 1 {
            ++result;
        } ++result result return result; result int N N public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    }
} Main
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        int result = N;
        while (String.valueOf(result).chars().distinct().count() != 1) {
            ++result;
        }

        return result;
    }
}