#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
#define double long double
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

lint c = 1;

lint diff(string &s, string &t){
    lint a = stoll(s), b = stoll(t);
    return min(abs(a-b), c - abs(a-b));
}

int main(){
    string s;
    cin >> s;
    rep(_, s.size()) c *= 10;
    string p;
    rep(i, 10) p += '0'+i;
    string ans = p.substr(0, s.size());
    do{
        string q = p.substr(0, s.size());
        if(diff(ans, s) < diff(q, s)) ans = q;
    }while(next_permutation(p.begin(), p.end()));
    cout << ans << "\n";
}

### Prompt

Your task is to create a Cpp solution to the following problem:

Example

Input

201


Output

701

### Response

```cpp
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
#define double long double
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

lint c = 1;

lint diff(string &s, string &t){
    lint a = stoll(s), b = stoll(t);
    return min(abs(a-b), c - abs(a-b));
}

int main(){
    string s;
    cin >> s;
    rep(_, s.size()) c *= 10;
    string p;
    rep(i, 10) p += '0'+i;
    string ans = p.substr(0, s.size());
    do{
        string q = p.substr(0, s.size());
        if(diff(ans, s) < diff(q, s)) ans = q;
    }while(next_permutation(p.begin(), p.end()));
    cout << ans << "\n";
}

```