import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	}
} 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();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc double div = (double) n / 111; div (double) n / 111 (double) n 111 if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		} div % 1 == 0 div % 1 div 1 0 {
			System.out.println(((int) div) * 111);
		} System.out.println(((int) div) * 111) System.out.println System.out System System.out ((int) div) * 111 ((int) div) 111 {
			System.out.println(((int) div + 1) * 111);
		} System.out.println(((int) div + 1) * 111) System.out.println System.out System System.out ((int) div + 1) * 111 ((int) div + 1) (int) div 1 111 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double div = (double) n / 111;
		if (div % 1 == 0) {
			System.out.println(((int) div) * 111);
		} else {
			System.out.println(((int) div + 1) * 111);
		}
	}
}