#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
#include <sstream>
#include <cassert>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;




string inst(int number){
	string res;
	stringstream ss;
	ss<<number;
	ss>>res;
	//cout<<res<<endl;
  return res;
}

bool foo(int a){
	//cout<<a<<endl;
	string s;
	s=inst(a);
	//cout<<s<<endl;
	rep(i,s.size()){
		if(s[i]!=s[s.size()-1-i]) return false;
	}
	return true;
}


int main(){
	int n;
	cin>>n;
	rep(i,INF){
		if(foo(n-i)){
			cout<<n-i<<endl;
			break;
		}
		else if(foo(n+i)){
			cout<<n+i<<endl;
			break;
		}
	}
	return 0;
}
### Prompt

Generate a cpp solution to the following problem:

Palindrome

Problem Statement

Find the number of palindromes closest to the integer n.

Note that the non-negative integer x is the number of palindromes, which means that the character string in which x is expressed in decimal notation and the character string in which it is inverted are equal.
For example, 0,7,33,10301 is the number of palindromes, and 32,90,1010 is not the number of palindromes.

Constraints

* 1 ≤ n ≤ 10 ^ 4

Input

Input follows the following format. All given numbers are integers.


n

Output

Output the number of palindromes closest to n.
If there are multiple such numbers, output the smallest one.

Examples

Input

13


Output

11


Input

7447


Output

7447


Input

106


Output

101

### Response

```cpp
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
#include <sstream>
#include <cassert>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;




string inst(int number){
	string res;
	stringstream ss;
	ss<<number;
	ss>>res;
	//cout<<res<<endl;
  return res;
}

bool foo(int a){
	//cout<<a<<endl;
	string s;
	s=inst(a);
	//cout<<s<<endl;
	rep(i,s.size()){
		if(s[i]!=s[s.size()-1-i]) return false;
	}
	return true;
}


int main(){
	int n;
	cin>>n;
	rep(i,INF){
		if(foo(n-i)){
			cout<<n-i<<endl;
			break;
		}
		else if(foo(n+i)){
			cout<<n+i<<endl;
			break;
		}
	}
	return 0;
}
```