#include using namespace std; //#include //atcoder //using namespace atcoder; //atcoder #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using ll = long long; using ld = long double; using vi = vector; using vl = vector; using vc = vector; using vs = vector; using vb = vector; using vd = vector; using vld = vector; using vvi = vector>; using vvl = vector>; using vvc = vector>; using vvs = vector>; using vvb = vector>; using vvd = vector>; using vvld = vector>; // Graph using Graph = vector>; using Nodes = pair; //using pri = priority_queue; //最大値 //using pri = priority_queue, greater>; //最小値 #define _GLIBCXX_DEBUG #define endl "\n" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) const int INF = 1e9; const int MININF = -1e9; const ll LINF = 1e18; const ll MINLINF = -1e18; const int MOD = 1e9+7; const int MODD = 998244353; // 4方向 vi vx={0, 1, 0, -1}; vi vy={1, 0, -1, 0}; // a bool chmax(T &a, const T& b){ if(abならaをbに更新 template bool chmin(T &a, const T& b){ if(a > b){ a = b; return true; } return false; } // NのK乗をMで割った余り ll power(ll N, ll K, ll M){ if(K == 0)return 1; else if(K%2 == 1){ return power(N, K-1, M) * N % M; } else{ ll T = power(N, K/2, M); return T * T % M; } } int M(int N){ int ans=0; while(N>0){ chmax(ans,N%10); N/=10; } return ans; } int m(int N){ int ans=1000; while(N>0){ chmin(ans,N%10); N/=10; } return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; cout<