#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;
	string t;
	long long int box = -1;
	long long int ten = pow(10, s.size());
	t = "0123456789";
	string ans;
	do {
		auto u = t.substr(0, s.size());
		long long int dif = min((long long int)abs(stoll(s) - stoll(u)), ten - abs(stoll(s) - stoll(u)));
	//	cout << dif << endl;
		if (dif > box) {
			box = dif;
			ans = u;
		}
	} while (next_permutation(t.begin(), t.end()));
	cout << ans << endl;
}

### Prompt

In cpp, your task is to solve the following problem:

Example

Input

201


Output

701

### Response

```cpp
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;
	string t;
	long long int box = -1;
	long long int ten = pow(10, s.size());
	t = "0123456789";
	string ans;
	do {
		auto u = t.substr(0, s.size());
		long long int dif = min((long long int)abs(stoll(s) - stoll(u)), ten - abs(stoll(s) - stoll(u)));
	//	cout << dif << endl;
		if (dif > box) {
			box = dif;
			ans = u;
		}
	} while (next_permutation(t.begin(), t.end()));
	cout << ans << endl;
}

```