import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	}

} Main public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	} main {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int debut = (int) (Math.ceil(n / 111.0) * 111); debut (int) (Math.ceil(n / 111.0) * 111) Math.ceil(n / 111.0) Math.ceil Math n / 111.0 n 111.0 111 System.out.println(debut) System.out.println System.out System System.out debut String[] args args public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	}

} public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		int debut = (int) (Math.ceil(n / 111.0) * 111);
		System.out.println(debut);

	}

}