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[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	}
} 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[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	} 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[] abc = {111,222,333,444,555,666,777,888,999}; abc {111,222,333,444,555,666,777,888,999} 111 222 333 444 555 666 777 888 999 for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		} int i abc {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		} {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		} if(n <= i) {
				System.out.println(i);
				return;
			} n <= i n i {
				System.out.println(i);
				return;
			} System.out.println(i) System.out.println System.out System System.out i return; 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[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	}
} 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[] abc = {111,222,333,444,555,666,777,888,999};
		
		for(int i : abc) {
			if(n <= i) {
				System.out.println(i);
				return;
			}
		}
		
	}
}
