import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	} main {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		} true {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		} Integer w = new Integer(n); w new Integer(n) String s = w.toString(); s w.toString() w.toString w List<String> list= new ArrayList<String>(Arrays.asList(s.split(""))); list new ArrayList<String>(Arrays.asList(s.split(""))) int count=0; count 0 for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			} int i=0; int i=0; i 0 list.size()-1>i list.size()-1 list.size() list.size list 1 i i++ i++ i {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			} {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			} if(list.get(i).equals(list.get(i+1)))
					count++; list.get(i).equals(list.get(i+1)) list.get(i).equals list.get(i) list.get list i list.get(i+1) list.get list i+1 i 1 count++ count if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			} count==list.size()-1 count list.size()-1 list.size() list.size list 1 {
				System.out.println(n);
				System.exit(0);
			} System.out.println(n) System.out.println System.out System System.out n System.exit(0) System.exit System 0 n++ n String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		while(true) {
			Integer w = new Integer(n);
			String s = w.toString();
			List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
			int count=0;
			for(int i=0;list.size()-1>i;i++) {
				if(list.get(i).equals(list.get(i+1)))
					count++;
			}
			if(count==list.size()-1) {
				System.out.println(n);
				System.exit(0);
			}
			n++;
		}
	}
}