import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	}
} Main public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	} main {
		new Main().solve(new Scanner(System.in));
	} new Main().solve(new Scanner(System.in)) new Main().solve new Main() new Scanner(System.in) String[] args args public void solve(Scanner sc) {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	} solve {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	} String n = sc.next(); n sc.next() sc.next sc char first = n.charAt(0); first n.charAt(0) n.charAt n 0 char second = n.charAt(1); second n.charAt(1) n.charAt n 1 char third = n.charAt(2); third n.charAt(2) n.charAt n 2 if(first == second && second == third) {
			System.out.println(n);
			return;
		} first == second && second == third first == second first second second == third second third {
			System.out.println(n);
			return;
		} System.out.println(n) System.out.println System.out System System.out n return; StringBuilder answerBuilder = new StringBuilder(); answerBuilder new StringBuilder() if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		} first < second first second {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} int answerNum = Character.getNumericValue(first) + 1; answerNum Character.getNumericValue(first) + 1 Character.getNumericValue(first) Character.getNumericValue Character first 1 answerBuilder.append(answerNum).append(answerNum).append(answerNum) answerBuilder.append(answerNum).append(answerNum).append answerBuilder.append(answerNum).append(answerNum) answerBuilder.append(answerNum).append answerBuilder.append(answerNum) answerBuilder.append answerBuilder answerNum answerNum answerNum System.out.println(answerBuilder.toString()) System.out.println System.out System System.out answerBuilder.toString() answerBuilder.toString answerBuilder return; if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		} first == second first second {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			} second < third second third {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} int answerNum = Character.getNumericValue(first) + 1; answerNum Character.getNumericValue(first) + 1 Character.getNumericValue(first) Character.getNumericValue Character first 1 answerBuilder.append(answerNum).append(answerNum).append(answerNum) answerBuilder.append(answerNum).append(answerNum).append answerBuilder.append(answerNum).append(answerNum) answerBuilder.append(answerNum).append answerBuilder.append(answerNum) answerBuilder.append answerBuilder answerNum answerNum answerNum System.out.println(answerBuilder.toString()) System.out.println System.out System System.out answerBuilder.toString() answerBuilder.toString answerBuilder return; {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			} answerBuilder.append(first).append(first).append(first) answerBuilder.append(first).append(first).append answerBuilder.append(first).append(first) answerBuilder.append(first).append answerBuilder.append(first) answerBuilder.append answerBuilder first first first System.out.println(answerBuilder.toString()) System.out.println System.out System System.out answerBuilder.toString() answerBuilder.toString answerBuilder return; {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		} answerBuilder.append(first).append(first).append(first) answerBuilder.append(first).append(first).append answerBuilder.append(first).append(first) answerBuilder.append(first).append answerBuilder.append(first) answerBuilder.append answerBuilder first first first System.out.println(answerBuilder.toString()) System.out.println System.out System System.out answerBuilder.toString() answerBuilder.toString answerBuilder return; Scanner sc sc public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	}
} public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String n = sc.next();
		char first = n.charAt(0);
		char second = n.charAt(1);
		char third = n.charAt(2);
		
		if(first == second && second == third) {
			System.out.println(n);
			return;
		}
		
		StringBuilder answerBuilder = new StringBuilder();
		if(first < second) {
			int answerNum = Character.getNumericValue(first) + 1;
			answerBuilder.append(answerNum).append(answerNum).append(answerNum);
			System.out.println(answerBuilder.toString());
			return;
		} else if(first == second) {
			if(second < third) {
				int answerNum = Character.getNumericValue(first) + 1;
				answerBuilder.append(answerNum).append(answerNum).append(answerNum);
				System.out.println(answerBuilder.toString());
				return;
			} else {
				answerBuilder.append(first).append(first).append(first);
				System.out.println(answerBuilder.toString());
				return;
			}
		} else {
			answerBuilder.append(first).append(first).append(first);
			System.out.println(answerBuilder.toString());
			return;
		}
	}
}
