import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    } main {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int x = s.nextInt(); x s.nextInt() s.nextInt s int n = x / 100; n x / 100 x 100 int ans; ans if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        } n*111 >= x n*111 n 111 x {
            ans = n*111;
        } ans = n*111 ans n*111 n 111 {
            ans = (n+1)*111;
        } ans = (n+1)*111 ans (n+1)*111 (n+1) n 1 111 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int n = x / 100;
        int ans;
        if(n*111 >= x){
            ans = n*111;
        }else {
            ans = (n+1)*111;
        }
        System.out.println(ans);
    }
}
