import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
}
} import java.util.Scanner; Scanner java.util public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
}
} Main public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
} main {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int a=scan.nextInt(); a scan.nextInt() scan.nextInt scan for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	} int i=a; int i=a; i a i++ i++ i {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	} {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	} int e=i; e i int b=e%10; b e%10 e 10 e/=10 e 10 int c=e%10; c e%10 e 10 e/=10 e 10 int d=e%10; d e%10 e 10 if(b==d&&c==d) {
			System.out.println(i);
			break;
		} b==d&&c==d b==d b d c==d c d {
			System.out.println(i);
			break;
		} System.out.println(i) System.out.println System.out System System.out i break; scan.close() scan.close scan String[]srgs srgs public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
}
} public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
}
} Main
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
}
}
