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;
		}
	}
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz