import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int waru = n / 100; waru n / 100 n 100 int x = waru * 100; x waru * 100 waru 100 int y = waru * 10; y waru * 10 waru 10 int z = waru * 1; z waru * 1 waru 1 int w = x + y + z; w x + y + z x + y + z x y z if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        } n <= w n w {
            System.out.println(w);
        } System.out.println(w) System.out.println System.out System System.out w {
            System.out.println(w + 111);
        } System.out.println(w + 111) System.out.println System.out System System.out w + 111 w 111 String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int waru = n / 100;
        int x = waru * 100;
        int y = waru * 10;
        int z = waru * 1;
        int w = x + y + z;
        if(n <= w){
            System.out.println(w);
        }
        else {
            System.out.println(w + 111);
        }
    }
}
