import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan if (n <= 111) {
			System.out.println(111);
			return;
		} n <= 111 n 111 {
			System.out.println(111);
			return;
		} System.out.println(111) System.out.println System.out System System.out 111 return; if (n <= 222) {
			System.out.println(222);
			return;
		} n <= 222 n 222 {
			System.out.println(222);
			return;
		} System.out.println(222) System.out.println System.out System System.out 222 return; if (n <= 333) {
			System.out.println(333);
			return;
		} n <= 333 n 333 {
			System.out.println(333);
			return;
		} System.out.println(333) System.out.println System.out System System.out 333 return; if (n <= 444) {
			System.out.println(444);
			return;
		} n <= 444 n 444 {
			System.out.println(444);
			return;
		} System.out.println(444) System.out.println System.out System System.out 444 return; if (n <= 555) {
			System.out.println(555);
			return;
		} n <= 555 n 555 {
			System.out.println(555);
			return;
		} System.out.println(555) System.out.println System.out System System.out 555 return; if (n <= 666) {
			System.out.println(666);
			return;
		} n <= 666 n 666 {
			System.out.println(666);
			return;
		} System.out.println(666) System.out.println System.out System System.out 666 return; if (n <= 777) {
			System.out.println(777);
			return;
		} n <= 777 n 777 {
			System.out.println(777);
			return;
		} System.out.println(777) System.out.println System.out System System.out 777 return; if (n <= 888) {
			System.out.println(888);
			return;
		} n <= 888 n 888 {
			System.out.println(888);
			return;
		} System.out.println(888) System.out.println System.out System System.out 888 return; if (n <= 999) {
			System.out.println(999);
			return;
		} n <= 999 n 999 {
			System.out.println(999);
			return;
		} System.out.println(999) System.out.println System.out System System.out 999 return; String[] args args public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	}
} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	}
}
