import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int inum = n/100; inum n/100 n 100 String str = ""+inum+inum+inum; str ""+inum+inum+inum inum ""+inum+inum+inum "" inum inum inum int xxx = Integer.parseInt(str); xxx Integer.parseInt(str) Integer.parseInt Integer str if(xxx < n) xxx += 111; xxx < n xxx n xxx += 111 xxx 111 System.out.println(xxx) System.out.println System.out System System.out xxx String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int inum = n/100;
        String str = ""+inum+inum+inum;
        int xxx = Integer.parseInt(str);
        if(xxx < n) xxx += 111;
        System.out.println(xxx);
    }
}