import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	} main {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = String.valueOf(sc.nextInt()); n String.valueOf(sc.nextInt()) String.valueOf String sc.nextInt() sc.nextInt sc String rn = "" rn "" rs = ""; rs "" char n1 = n.charAt(0) n1 n.charAt(0) n.charAt n 0 n2 = n.charAt(1) n2 n.charAt(1) n.charAt n 1 n3 = n.charAt(2); n3 n.charAt(2) n.charAt n 2 if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		} n1 == n2 && n2 == n3 n1 == n2 n1 n2 n2 == n3 n2 n3 {
			System.out.println(Integer.valueOf(n));
			return;
		} System.out.println(Integer.valueOf(n)) System.out.println System.out System System.out Integer.valueOf(n) Integer.valueOf Integer n return; if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		} n1 == n2 n1 n2 {
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		} if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			} (int)n2 > (int)n3 (int)n2 (int)n3 {
				rs = String.valueOf(n1);
			} rs = String.valueOf(n1) rs String.valueOf(n1) String.valueOf String n1 {
				 rs = String.valueOf((char)((int)n1 + 1));
			} rs = String.valueOf((char)((int)n1 + 1)) rs String.valueOf((char)((int)n1 + 1)) String.valueOf String (char)((int)n1 + 1) (int)n1 1 {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		} if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			} (int)n1 > (int)n2 (int)n1 (int)n2 {
				rs = String.valueOf(n1);
			} rs = String.valueOf(n1) rs String.valueOf(n1) String.valueOf String n1 {
				rs = String.valueOf((char)((int)n1 + 1));
			} rs = String.valueOf((char)((int)n1 + 1)) rs String.valueOf((char)((int)n1 + 1)) String.valueOf String (char)((int)n1 + 1) (int)n1 1 rn += rs+rs+rs rn rs+rs+rs rs+rs+rs rs rs rs System.out.println(rn) System.out.println System.out System System.out rn String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = String.valueOf(sc.nextInt());
		String rn = "",rs = "";
		char n1 = n.charAt(0),n2 = n.charAt(1),n3 = n.charAt(2);
		if(n1 == n2 && n2 == n3) {
			System.out.println(Integer.valueOf(n));
			return;
		}else if(n1 == n2){
			if((int)n2 > (int)n3) {
				rs = String.valueOf(n1);
			}else {
				 rs = String.valueOf((char)((int)n1 + 1));
			}
		}else {
			if((int)n1 > (int)n2) {
				rs = String.valueOf(n1);
			}else {
				rs = String.valueOf((char)((int)n1 + 1));
			}
		}
		rn += rs+rs+rs;
		System.out.println(rn);
	}
}