#include #include #include #include using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; typedef vector vi; typedef pair pii; typedef vector > vpii; typedef long long ll; template static void amin(T &x, U y) { if(y < x) x = y; } template static void amax(T &x, U y) { if(x < y) x = y; } string add(const string &x, const string &y) { string z(max(x.size(), y.size()), '?'); bool carry = false; rep(i, z.size()) { int xx = i < (int)x.size() ? x[i] - '0' : 0; int yy = i < (int)y.size() ? y[i] - '0' : 0; int zz = xx + yy + carry; carry = zz >= 10; z[i] = '0' + zz % 10; } if(carry) z += '1'; return z; } string rstr(const char *a, const char *b) { string r(a, b); reverse(r.begin(), r.end()); return r; } int main() { int T; scanf("%d", &T); char *S = new char[10000010]; for(int ii = 0; ii < T; ++ ii) { scanf("%s", S); int len = strlen(S); sort(S, S + len); reverse(S, S + len); string ans; if(len > 1) { if(S[len - 1] == '0') { int i = len - 1; while(S[i] == '0') -- i; swap(S[len - 1], S[i]); } if(S[0] != '0') ans = add(rstr(S, S + len - 1), rstr(S + len - 1, S + len)); } if(ans.empty()) { puts("Uncertain"); } else { reverse(ans.begin(), ans.end()); puts(ans.c_str()); } } return 0; }