import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int t = (N-1) / 111;
		System.out.println(111*(t+1));
	}
} 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 t = (N-1) / 111;
		System.out.println(111*(t+1));
	}
} Main public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int t = (N-1) / 111;
		System.out.println(111*(t+1));
	} main {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int t = (N-1) / 111;
		System.out.println(111*(t+1));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int t = (N-1) / 111; t (N-1) / 111 (N-1) N 1 111 System.out.println(111*(t+1)) System.out.println System.out System System.out 111*(t+1) 111 (t+1) t 1 String args[] args public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int t = (N-1) / 111;
		System.out.println(111*(t+1));
	}
} public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int t = (N-1) / 111;
		System.out.println(111*(t+1));
	}
} 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 t = (N-1) / 111;
		System.out.println(111*(t+1));
	}
}
