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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} Main public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } main {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    } try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            } true {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            } String tmp = String.valueOf(n); tmp String.valueOf(n) String.valueOf String n if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                } tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2) tmp.charAt(0) == tmp.charAt(1) tmp.charAt(0) tmp.charAt tmp 0 tmp.charAt(1) tmp.charAt tmp 1 tmp.charAt(0) == tmp.charAt(2) tmp.charAt(0) tmp.charAt tmp 0 tmp.charAt(2) tmp.charAt tmp 2 {
                    System.out.println(n);
                    break;
                } System.out.println(n) System.out.println System.out System System.out n break; n++ n String[] args args public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            while (true) {
                String tmp = String.valueOf(n);
                if (tmp.charAt(0) == tmp.charAt(1) && tmp.charAt(0) == tmp.charAt(2)) {
                    System.out.println(n);
                    break;
                }
                n++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
