import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	}
} 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();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String n = String.valueOf(N); n String.valueOf(N) String.valueOf String N int num =Integer.valueOf(n.substring(0,1)); num Integer.valueOf(n.substring(0,1)) Integer.valueOf Integer n.substring(0,1) n.substring n 0 1 if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		} num<Integer.valueOf(n.substring(1,2)) num Integer.valueOf(n.substring(1,2)) Integer.valueOf Integer n.substring(1,2) n.substring n 1 2 {
			num++;
			System.out.println(""+num+num+num);
		} num++ num System.out.println(""+num+num+num) System.out.println System.out System System.out ""+num+num+num num ""+num+num+num "" num num num if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		} num<Integer.valueOf(n.substring(2,3)) num Integer.valueOf(n.substring(2,3)) Integer.valueOf Integer n.substring(2,3) n.substring n 2 3 {
			num++;
			System.out.println(""+num+num+num);
		} num++ num System.out.println(""+num+num+num) System.out.println System.out System System.out ""+num+num+num num ""+num+num+num "" num num num {
			System.out.println(""+num+num+num);
		} System.out.println(""+num+num+num) System.out.println System.out System System.out ""+num+num+num num ""+num+num+num "" num num num sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String n = String.valueOf(N);
		int num =Integer.valueOf(n.substring(0,1));
		
		if(num<Integer.valueOf(n.substring(1,2))){
			num++;
			System.out.println(""+num+num+num);
		}else if(num<Integer.valueOf(n.substring(2,3))){
			num++;
			System.out.println(""+num+num+num);
		}else {
			System.out.println(""+num+num+num);
		}
		
		sc.close();
	}
}