import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	}
} Main public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++; (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 (n%10) != (n/10)%10 (n%10) n 10 (n/10)%10 (n/10) n 10 10 ((n/10)%10) != (n/100)%10 ((n/10)%10) (n/10) n 10 10 (n/100)%10 (n/100) n 100 10 n++ 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)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	}
} public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		while( (n%10) != (n/10)%10 || ((n/10)%10) != (n/100)%10 )n++;
		
		System.out.println(n);
	}
}
