#include #include #include #include #include #include #include #include #include #include using namespace::std; #define ls t<<1 #define rs (t<<1)|1 #define sqr(x) ((x)*(x)) typedef __int64 ll; typedef pair pii; const int inf = 0x3f3f3f3f; const double eps = 1e-6; const int maxn = 1e7 + 10; const int maxm = 1e6 + 10; int t; char a[maxn], s1[maxn], s2[maxn], res[maxn]; int main() { scanf("%d", &t); while (t--) { scanf("%s", a); int len = strlen(a); if (len == 1) { puts("Uncertain"); continue; } sort(a, a + len); int flag = 0; if (a[0] == '0') { for (int i = 1; i < len; i++) { if (a[i] != '0') { if (i == len - 1) { flag = 1; } swap(a[i], a[0]); break; } } } if (flag) { puts("Uncertain"); continue; } a[1] += a[0] - '0'; int k = 1; while (a[k] > '9') { a[k++] -= 10; a[k]++; } if (k == len) printf("1"); for (int i = len - 1; i > 0; i--) printf("%c", a[i]); puts(""); } }