#include <bits/stdc++.h>
using namespace std;

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    string n;
    cin >> n;
    string s = "0123456789";
    Int ma = -INF;
    string res = "";
    Int x = 1;
    for (Int i = 0; i < (Int)n.size(); i++) {
        x *= 10;
    }
    do {
        string t = "";
        for (Int i = 0; i < (Int)n.size(); i++) {
            t.push_back(s[i]);
        }
        Int a = stoll(n);
        Int b = stoll(t);
        if (min(abs(a - b), x - abs(a - b)) > ma) {
            ma = min(abs(a - b), x - abs(a - b));
            res = t;
        }
    } while (next_permutation(all(s)));
    print(res);
    return 0;
}


### Prompt

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

Example

Input

201


Output

701

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    string n;
    cin >> n;
    string s = "0123456789";
    Int ma = -INF;
    string res = "";
    Int x = 1;
    for (Int i = 0; i < (Int)n.size(); i++) {
        x *= 10;
    }
    do {
        string t = "";
        for (Int i = 0; i < (Int)n.size(); i++) {
            t.push_back(s[i]);
        }
        Int a = stoll(n);
        Int b = stoll(t);
        if (min(abs(a - b), x - abs(a - b)) > ma) {
            ma = min(abs(a - b), x - abs(a - b));
            res = t;
        }
    } while (next_permutation(all(s)));
    print(res);
    return 0;
}


```