import java.util.*;

class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int ans = 0;
        for(int i = n; i < 1000; i++){
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int ans = 0;
        for(int i = n; i < 1000; i++){
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
} Main public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int ans = 0;
        for(int i = n; i < 1000; i++){
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int ans = 0;
        for(int i = n; i < 1000; i++){
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = n; i < 1000; i++){
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        } int i = n; int i = n; i n i < 1000 i 1000 i++ i++ i {
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        } {
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        } int k = i / 10; k i / 10 i 10 int l = i - (int)((i / 100) * 100); l i - (int)((i / 100) * 100) i (int)((i / 100) * 100) (i / 100) i 100 100 if(k == l){
                ans = i;
                break;
            } k == l k l {
                ans = i;
                break;
            } ans = i ans i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int ans = 0;
        for(int i = n; i < 1000; i++){
            int k = i / 10;
            int l = i - (int)((i / 100) * 100);
            if(k == l){
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}