import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	}
} import java.math.BigDecimal; BigDecimal java.math import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	} main {
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	} List <Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() List <String> list2 = new ArrayList<String>(); list2 new ArrayList<String>() int answer = 0; answer 0 int in = Integer.parseInt(sc.next()); in Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String d = ""; d "" Boolean e = false; e false for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		} int i = in; int i = in; i in i <= 999 i 999 i++ i++ i {
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		} {
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		} if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			} i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10 i/10 - i/100 == i/100 * 10 i/10 - i/100 i/10 i 10 i/100 i 100 i/100 * 10 i/100 i 100 10 i - i/100 == i/10*10 i - i/100 i i/100 i 100 i/10*10 i/10 i 10 10 {
				answer =i;
				break;
			} answer =i answer i break; System.out.println(answer) System.out.println System.out System System.out answer System.out.flush() System.out.flush System.out System System.out sc.close() sc.close sc String [] args args public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	}
} public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	}
} Main
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		List <String> list2 = new ArrayList<String>();
//		String s = sc.next();
		int answer = 0;
		int in = Integer.parseInt(sc.next());
//		int c = 0;
		String d = "";
		Boolean e = false;
		
		for(int i = in;i <= 999;i++){
			if(i/10 - i/100 == i/100 * 10 && i - i/100 == i/10*10){
				answer =i;
				break;
			}
		}
		
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	}
}