import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    } main {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int contestNumber = sc.nextInt(); contestNumber sc.nextInt() sc.nextInt sc int mod = contestNumber % 111; mod contestNumber % 111 contestNumber 111 if(mod == 0){
            System.out.println(contestNumber);
            return ;
        } mod == 0 mod 0 {
            System.out.println(contestNumber);
            return ;
        } System.out.println(contestNumber) System.out.println System.out System System.out contestNumber return ; int n = contestNumber / 111; n contestNumber / 111 contestNumber 111 System.out.println(111 * (n + 1)) System.out.println System.out System System.out 111 * (n + 1) 111 (n + 1) n 1 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int contestNumber = sc.nextInt();
        int mod = contestNumber % 111;
        if(mod == 0){
            System.out.println(contestNumber);
            return ;
        }
        int n = contestNumber / 111;
        System.out.println(111 * (n + 1));
    }
}
