#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    int k = 111;
    for(int i = 1; i < 10; i++){
        if(k >= n){
            cout << k << endl;
            return 0;
        }
        k += 111;
    }
}
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    int n;cin>>n;
    for(int i = n;i<10000;i++){
       string str = std::to_string(i);
       if(str[0] == str[1]&&str[1] == str[2]){
         cout<<i;
         return 0;
         break;
       }
    }
      
    return 0;
}