
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	}

} 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 earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int earliest = 1200; earliest 1200 for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		} int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		} {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		} int j = i * 111; j i * 111 i 111 if(N <= j && j < earliest) {
				earliest = j;
			} N <= j && j < earliest N <= j N j j < earliest j earliest {
				earliest = j;
			} earliest = j earliest j System.out.println(earliest) System.out.println System.out System System.out earliest String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	}

} 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 earliest = 1200;
		for(int i = 1; i <= 9; i++) {
			int j = i * 111;
			if(N <= j && j < earliest) {
				earliest = j;
			}
		}
		System.out.println(earliest);
	}

}
