import java.util.Scanner;

/**
 * @author shengboxu
 */

public class Main {
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
} 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();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 111; ans 111 for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        } int i = N; int i = N; i N i < 1000 i 1000 i++ i++ i {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        } {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        } String[] str = String.valueOf(i).split(""); str String.valueOf(i).split("") String.valueOf(i).split String.valueOf(i) String.valueOf String i "" if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            } str[0].equals(str[1]) && str[1].equals(str[2]) str[0].equals(str[1]) str[0].equals str[0] str 0 str[1] str 1 str[1].equals(str[2]) str[1].equals str[1] str 1 str[2] str 2 {
                ans = i;
                break;
            } ans = i ans i break; 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 sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

/**
 * @author shengboxu
 */

public class Main {
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 111;
        for (int i = N; i < 1000; i++) {
            String[] str = String.valueOf(i).split("");
            if (str[0].equals(str[1]) && str[1].equals(str[2])) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}
