import java.util.*;

import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	}
} import java.util.*; util.* java import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	} main {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	} int i i j; j Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = parseInt(sc.next()); n parseInt(sc.next()) parseInt sc.next() sc.next sc sc.close() sc.close sc for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		} i=1; i=1 i 1 i<=9 i 9 i++ i++ i {
			if(n<=i*111) {
				break;
			}
		} {
			if(n<=i*111) {
				break;
			}
		} if(n<=i*111) {
				break;
			} n<=i*111 n i*111 i 111 {
				break;
			} break; System.out.println(i*111) System.out.println System.out System System.out i*111 i 111 String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	}
} Main
import java.util.*;

import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	}
}
