import java.util.ArrayList;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	}
} import java.util.ArrayList; ArrayList java.util 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();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc boolean flag = false; flag false ArrayList<Integer> goals = new ArrayList<Integer>(); goals new ArrayList<Integer>() goals.add(111) goals.add goals 111 goals.add(222) goals.add goals 222 goals.add(333) goals.add goals 333 goals.add(444) goals.add goals 444 goals.add(555) goals.add goals 555 goals.add(666) goals.add goals 666 goals.add(777) goals.add goals 777 goals.add(888) goals.add goals 888 goals.add(999) goals.add goals 999 if(goals.contains(n)){flag=true;} goals.contains(n) goals.contains goals n {flag=true;} flag=true flag true while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		} n<=999&&flag==false n<=999 n 999 flag==false flag false {
			n++;
			flag = goals.contains(n);
		} n++ n flag = goals.contains(n) flag goals.contains(n) goals.contains goals n System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		ArrayList<Integer> goals = new ArrayList<Integer>();
		goals.add(111);
		goals.add(222);
		goals.add(333);
		goals.add(444);
		goals.add(555);
		goals.add(666);
		goals.add(777);
		goals.add(888);
		goals.add(999);
		
		if(goals.contains(n)){flag=true;}
		
		while(n<=999&&flag==false){
			n++;
			flag = goals.contains(n);
		}
		
		System.out.println(n);
	}
}