import java.util.Scanner;

public class Main{

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

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



	}
} 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 a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



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

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



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

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int a=0; a 0 int b=0; b 0 int c=0; c 0 for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		} int i=n; int i=n; i n i<1000 i 1000 i++ i++ i {
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		} {
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		} c=i/100 c i/100 i 100 b=i/10-c*10 b i/10-c*10 i/10 i 10 c*10 c 10 a=i%100-b*10 a i%100-b*10 i%100 i 100 b*10 b 10 if(a==b && b==c){
				System.out.println(i);
				break;
			} a==b && b==c a==b a b b==c b c {
				System.out.println(i);
				break;
			} System.out.println(i) System.out.println System.out System System.out i break; String[]args args public class Main{

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

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



	}
} public class Main{

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

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



	}
} Main
import java.util.Scanner;

public class Main{

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

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



	}
}
