
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	}

} 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();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int a = N / 100; a N / 100 N 100 int b = (N / 10) % 10; b (N / 10) % 10 (N / 10) N 10 10 int c = N % 10; c N % 10 N 10 int ans = 0; ans 0 if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		} a >= b && a >= c a >= b a b a >= c a c {
			ans = a * 100 + a * 10 + a;
		} ans = a * 100 + a * 10 + a ans a * 100 + a * 10 + a a * 100 + a * 10 + a a * 100 a 100 a * 10 a 10 a {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		} ans = (a + 1) * 100 + (a + 1) * 10 + a + 1 ans (a + 1) * 100 + (a + 1) * 10 + a + 1 a (a + 1) * 100 + (a + 1) * 10 + a + 1 (a + 1) * 100 (a + 1) a 1 100 (a + 1) * 10 (a + 1) a 1 10 a 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = N / 100;
		int b = (N / 10) % 10;
		int c = N % 10;
		int ans = 0;
		if(a >= b && a >= c) {
			ans = a * 100 + a * 10 + a;
		} else {
			ans = (a + 1) * 100 + (a + 1) * 10 + a + 1;
		}
		System.out.println(ans);
	}

}
