import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    }
} import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Scanner; Scanner java.util public class Main {
    static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    }
} Main static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    } gcd {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    } if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        } a % b != 0 a % b a b 0 {
            return gcd(b, a % b);
        } return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b {
            return b;
        } return b; b int a a int b b public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    } main {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int i = n / 111; i n / 111 n 111 if (n % 111 != 0) {
            i += 1;
        } n % 111 != 0 n % 111 n 111 0 {
            i += 1;
        } i += 1 i 1 System.out.println(i * 111) System.out.println System.out System System.out i * 111 i 111 String[] args args public class Main {
    static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    }
} public class Main {
    static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    }
} Main
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    }
}
