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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  }
}
       import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(in.readLine()); n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    } int i=111; int i=111; i 111 i<=999 i 999 i=i+111 i=i+111 i i+111 i 111 {
      if(i>=n){
        System.out.println(i);
        break;
      }
    } {
      if(i>=n){
        System.out.println(i);
        break;
      }
    } if(i>=n){
        System.out.println(i);
        break;
      } i>=n i n {
        System.out.println(i);
        break;
      } System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    for(int i=111; i<=999; i=i+111) {
      if(i>=n){
        System.out.println(i);
        break;
      }
    }
  }
}
      