import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    }
  	
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    }
  	
} Main public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    } main {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    } Scanner input = new Scanner(System.in); input new Scanner(System.in) String N = input.next(); N input.next() input.next input int[] ns = new int[9]; ns new int[9] 9 for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        } int i = 0; int i = 0; i 0 i < 9 i 9 i++ i++ i {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        } {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        } int num = i + 1; num i + 1 i 1 ns[i] = num * 100 + num * 10 + num ns[i] ns i num * 100 + num * 10 + num num * 100 + num * 10 + num num * 100 num 100 num * 10 num 10 num int ans = 1000; ans 1000 for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        } int i = 0; int i = 0; i 0 i < 9 i 9 i++ i++ i {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        } {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        } if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          } ns[i] >= Integer.parseInt(N) && ns[i] < ans ns[i] >= Integer.parseInt(N) ns[i] ns i Integer.parseInt(N) Integer.parseInt Integer N ns[i] < ans ns[i] ns i ans {
              ans = ns[i];
          } ans = ns[i] ans ns[i] ns i System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    }
  	
} public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    }
  	
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String N = input.next();
      	int[] ns = new int[9];
      	for (int i = 0; i < 9; i++) {
          	int num = i + 1;
        	ns[i] = num * 100 + num * 10 + num;
        }
      	int ans = 1000;
      	
      	for (int i = 0; i < 9; i++) {
          if (ns[i] >= Integer.parseInt(N) && ns[i] < ans) {
              ans = ns[i];
          }
        }
		System.out.print(ans);

    }
  	
}
