#include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000") using namespace std; #define MAX 100005 #define MAXN 1000005 #define maxnode 500005 #define sigma_size 30 #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define lrt rt<<1 #define rrt rt<<1|1 #define middle int m=(r+l)>>1 #define LL long long #define ull unsigned long long #define mem(x,v) memset(x,v,sizeof(x)) #define lowbit(x) (x&-x) #define pii pair #define bits(a) __builtin_popcount(a) #define mk make_pair const int prime = 999983; const int INF = 0x3f3f3f3f; const LL INFF = 1e18; const double pi = 3.141592653589793; const double inf = 1e18; const double eps = 1e-10; const int mod = 10007; const ull mx = 133333331; /*****************************************************/ inline int read_int(){ int ret=0; char tmp; while(!isdigit(tmp=getchar())); do{ ret=(ret<<3)+(ret<<1)+tmp-'0'; } while(isdigit(tmp=getchar())); return ret; } /*****************************************************/ char s[MAX]; char ss[MAX]; int T; bool check(char *s){ int len=strlen(s); int num1=0,num2=0; for(int i=0;i>T; while(T--){ scanf("%s",s); if(check(s)){ printf("%s\n",s); continue; } int len=strlen(s); if(len%2==1){ int n=(len+1)/2; for(int i=0;i'4'&&s[i]<'7'){ if(n2'7'){ f=1; break; } } if(f){ ss[pos]='7'; flag=pos+1; } int num1=0,num2=0; for(int i=0;i