#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    string pass; cin >> pass;
    int n = (int)pass.size();
    int po = 1;
    for(int i = 0; i < n; i++) po *= 10;

    string s = "0123456789";
    sort(s.begin(), s.end());
    
    string ans = "";
    int diff = 0;
    do{
        string t = s.substr(0, n);
        int val = (int)abs(stol(pass) - stol(t));
        int tmp = min(val, po - val);
        if(tmp > diff){
            diff = tmp;
            ans = t;
        }
        
    }while(next_permutation(s.begin(), s.end()));
    cout << ans << endl;
    return 0;
}


### Prompt

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

Example

Input

201


Output

701

### Response

```cpp
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    string pass; cin >> pass;
    int n = (int)pass.size();
    int po = 1;
    for(int i = 0; i < n; i++) po *= 10;

    string s = "0123456789";
    sort(s.begin(), s.end());
    
    string ans = "";
    int diff = 0;
    do{
        string t = s.substr(0, n);
        int val = (int)abs(stol(pass) - stol(t));
        int tmp = min(val, po - val);
        if(tmp > diff){
            diff = tmp;
            ans = t;
        }
        
    }while(next_permutation(s.begin(), s.end()));
    cout << ans << endl;
    return 0;
}


```