import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    }
} Main public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    } main {
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 0 < n && n <= 111 0 < n 0 n n <= 111 n 111 {
            System.out.println(111);
        } System.out.println(111) System.out.println System.out System System.out 111 if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 112 <= n && n <= 222 112 <= n 112 n n <= 222 n 222 {
            System.out.println(222);
        } System.out.println(222) System.out.println System.out System System.out 222 if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 223 <= n && n <= 333 223 <= n 223 n n <= 333 n 333 {
            System.out.println(333);
        } System.out.println(333) System.out.println System.out System System.out 333 if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 334 <= n && n <= 444 334 <= n 334 n n <= 444 n 444 {
            System.out.println(444);
        } System.out.println(444) System.out.println System.out System System.out 444 if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 445 <= n && n <= 555 445 <= n 445 n n <= 555 n 555 {
            System.out.println(555);
        } System.out.println(555) System.out.println System.out System System.out 555 if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 556 <= n && n <= 666 556 <= n 556 n n <= 666 n 666 {
            System.out.println(666);
        } System.out.println(666) System.out.println System.out System System.out 666 if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 667 <= n && n <= 777 667 <= n 667 n n <= 777 n 777 {
            System.out.println(777);
        } System.out.println(777) System.out.println System.out System System.out 777 if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        } 778 <= n && n <= 888 778 <= n 778 n n <= 888 n 888 {
            System.out.println(888);
        } System.out.println(888) System.out.println System.out System System.out 888 {
            System.out.println(999);
        } System.out.println(999) System.out.println System.out System System.out 999 final String[] args args public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    }
} public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    }
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(0 < n && n <= 111){
            System.out.println(111);
        }else if(112 <= n && n <= 222){
            System.out.println(222);
        }else if(223 <= n && n <= 333){
            System.out.println(333);
        }else if(334 <= n && n <= 444){
            System.out.println(444);
        }else if(445 <= n && n <= 555){
            System.out.println(555);
        }else if(556 <= n && n <= 666){
            System.out.println(666);
        }else if(667 <= n && n <= 777){
            System.out.println(777);
        }else if(778 <= n && n <= 888){
            System.out.println(888);
        }else{
            System.out.println(999);
        }
        






    }
}