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 = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	}
} 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 = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int a = N/100; a N/100 N 100 int b = (N - a*100)/10; b (N - a*100)/10 (N - a*100) N a*100 a 100 10 if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		} a > b a b {
			System.out.println(a*100 + a*10 + a);
		} System.out.println(a*100 + a*10 + a) System.out.println System.out System System.out a*100 + a*10 + a a*100 + a*10 + a a*100 a 100 a*10 a 10 a if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		} a == b a b {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} int c = N -a*100 -b*10; c N -a*100 -b*10 N -a*100 -b*10 N a*100 a 100 b*10 b 10 if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			} b >= c b c {
				System.out.println(a*100 + a*10 + a);
			} System.out.println(a*100 + a*10 + a) System.out.println System.out System System.out a*100 + a*10 + a a*100 + a*10 + a a*100 a 100 a*10 a 10 a {
				a ++;
				System.out.println(a*100 + a*10 + a);
			} a ++ a System.out.println(a*100 + a*10 + a) System.out.println System.out System System.out a*100 + a*10 + a a*100 + a*10 + a a*100 a 100 a*10 a 10 a {
			a++;
			System.out.println(a*100 + a*10 + a);
		} a++ a System.out.println(a*100 + a*10 + a) System.out.println System.out System System.out a*100 + a*10 + a a*100 + a*10 + a a*100 a 100 a*10 a 10 a String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	}
} 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 = N/100;
		int b = (N - a*100)/10;
		if (a > b) {
			System.out.println(a*100 + a*10 + a);
		} else if(a == b) {
			int c = N -a*100 -b*10;
			if (b >= c) {
				System.out.println(a*100 + a*10 + a);
			}else {
				a ++;
				System.out.println(a*100 + a*10 + a);
			}
		} else {
			a++;
			System.out.println(a*100 + a*10 + a);
		}
	}
}
