#include<bits/stdc++.h>
#define pii pair<int,int>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string.h>
#include<ctype.h>
#include<queue>
#include<set>
#include<stack>
#include<cmath>
const int N=1e6+10;
const int maxn=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
const int inf=99999999;
using namespace std;
int n;
int check(int n)
{
	int m=n%10,k=n/10;
	while(k)
	{
		if(m!=k%10)
			return 1;
		k/=10;
	}
	return 0;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	while(check(n))
		n++;
	cout<<n<<endl;
	return 0;
}
