#include #include using namespace std; using namespace atcoder; typedef int64_t lint; #define rep(i, n) for(int i=0; i; using vvi = vector>; template inline void vin(vector& v) { rep(i, v.size()) cin >> v.at(i); } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template inline void drop(T x) { cout << x << endl; exit(0); } template void vout(vector v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; } constexpr lint LINF = LLONG_MAX/2; bool isPrime(lint n) { if (n < 2) return false; if (n == 2) return true; if (!(n % 2)) return false; int rn = sqrt(n); vector v(rn+1); for(lint i = 3; i <= rn; i += 2) { if(!v.at(i)) { if (!(n % i)) return false; v.at(i) = 1; for(lint j = i*i; j <= rn; j += i) { v.at(j) = 1; } } } return true; } int main() { string S; cin >> S; lint N = S.size(); lint a=0, b=0, c=0, x, y, z; multiset s; rep(bit, (1<<(N-1))) { a = 0; b = 0; rep(i, N) { b *= 10; b += S[i]-'0'; if (bit & 1<