import java.util.*;
class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int[] res = new int[]{111,222,333,444,555,666,777,888,999};
      	int n = sc.nextInt();
      	int i = 0;
      	while(res[i] < n) {
        	i++;
        }
      	System.out.println(String.valueOf(res[i]));
    }
} import java.util.*; util.* java class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int[] res = new int[]{111,222,333,444,555,666,777,888,999};
      	int n = sc.nextInt();
      	int i = 0;
      	while(res[i] < n) {
        	i++;
        }
      	System.out.println(String.valueOf(res[i]));
    }
} Main public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int[] res = new int[]{111,222,333,444,555,666,777,888,999};
      	int n = sc.nextInt();
      	int i = 0;
      	while(res[i] < n) {
        	i++;
        }
      	System.out.println(String.valueOf(res[i]));
    } main {
    	Scanner sc = new Scanner(System.in);
      	int[] res = new int[]{111,222,333,444,555,666,777,888,999};
      	int n = sc.nextInt();
      	int i = 0;
      	while(res[i] < n) {
        	i++;
        }
      	System.out.println(String.valueOf(res[i]));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] res = new int[]{111,222,333,444,555,666,777,888,999}; res new int[]{111,222,333,444,555,666,777,888,999} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int i = 0; i 0 while(res[i] < n) {
        	i++;
        } res[i] < n res[i] res i n {
        	i++;
        } i++ i System.out.println(String.valueOf(res[i])) System.out.println System.out System System.out String.valueOf(res[i]) String.valueOf String res[i] res i String args[] args
import java.util.*;
class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int[] res = new int[]{111,222,333,444,555,666,777,888,999};
      	int n = sc.nextInt();
      	int i = 0;
      	while(res[i] < n) {
        	i++;
        }
      	System.out.println(String.valueOf(res[i]));
    }
}