import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

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());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    }
} import java.util.HashSet; HashSet java.util import java.util.Set; Set java.util import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util 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());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    } 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 int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999}; contests {111, 222, 333, 444, 555, 666, 777, 888, 999} 111 222 333 444 555 666 777 888 999 int ans = 111; ans 111 for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        } int i = 0; int i = 0; i 0 i < contests.length i contests.length contests contests.length i++ i++ i {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        } {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        } if (n <= contests[i]) {
                ans = contests[i];
                break;
            } n <= contests[i] n contests[i] contests i {
                ans = contests[i];
                break;
            } ans = contests[i] ans contests[i] contests i break; System.out.println(ans) System.out.println System.out System System.out ans 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());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    }
} 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());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    }
} Main
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

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());
        int[] contests = {111, 222, 333, 444, 555, 666, 777, 888, 999};
        int ans = 111;
        
        for (int i = 0; i < contests.length; i++) {
            if (n <= contests[i]) {
                ans = contests[i];
                break;
            }
            
        }
        
        System.out.println(ans);
    }
}
