import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	}
} Main public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	} main {
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	} Scanner in = new java.util.Scanner(System.in); in new java.util.Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int a = N/100; a N/100 N 100 int x = a*100 + a*10 + a; x a*100 + a*10 + a a*100 + a*10 + a a*100 a 100 a*10 a 10 a if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		} N <= x N x {
			System.out.println(x);
		} System.out.println(x) System.out.println System.out System System.out x {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		} a++ a x = a*100 + a*10 + a x a*100 + a*10 + a a*100 + a*10 + a a*100 a 100 a*10 a 10 a System.out.println(x) System.out.println System.out System System.out x in.close() in.close in String[] args args public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	}
} public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int a = N/100;
		int x = a*100 + a*10 + a;
		
		if(N <= x) {
			System.out.println(x);
		}else {
			a++;
			x = a*100 + a*10 + a;
			System.out.println(x);
		}
		
		
		
		in.close();
	}
}
