#include <stdio.h>
int isWeird(int* s, int a, int b, int k, int n){
int i,t,r;
if(k==n) return 0;
else if(k<n) return -1;
for(i=a;(t=k-s[i])>=n;i++){
r=isWeird(s,i+1,b,t,n);
if(r==0) return r;
}
return -1;
}
int main(void) {
int c, n, s[1000],b,i,k;
s[0]=1;
while(c--){
b=k=1;
for(i=2;i*i<=n;i++){
if(n%i==0) s[b++]=i;
}
for(i=b-1;i>0;i--){
k+=s[i];
s[b]=n/s[i];
if(s[b]!=s[i]) k+=s[b++];
}
if(k>n){
if(isWeird
(s
,0,b
,k
,n
)) printf("weird\n"); } else {
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgaXNXZWlyZChpbnQqIHMsIGludCBhLCBpbnQgYiwgaW50IGssIGludCBuKXsKCWludCBpLHQscjsKCXByaW50ZigiJWRcbiIsayk7CglpZihrPT1uKSByZXR1cm4gMDsKCWVsc2UgaWYoazxuKSByZXR1cm4gLTE7Cglmb3IoaT1hOyh0PWstc1tpXSk+PW47aSsrKXsKCQlyPWlzV2VpcmQocyxpKzEsYix0LG4pOwoJCWlmKHI9PTApIHJldHVybiByOwoJfQoJcmV0dXJuIC0xOwp9CgppbnQgbWFpbih2b2lkKSB7CglpbnQgYywgbiwgc1sxMDAwXSxiLGksazsKCXNjYW5mKCIlZCIsJmMpOwoJc1swXT0xOwoJd2hpbGUoYy0tKXsKCQlzY2FuZigiJWQiLCZuKTsKCQliPWs9MTsKCQlmb3IoaT0yO2kqaTw9bjtpKyspewoJCQlpZihuJWk9PTApIHNbYisrXT1pOwoJCX0KCQlmb3IoaT1iLTE7aT4wO2ktLSl7CgkJCWsrPXNbaV07CgkJCXNbYl09bi9zW2ldOwoJCQlpZihzW2JdIT1zW2ldKSBrKz1zW2IrK107CgkJfQoJCWlmKGs+bil7CgkJCWlmKGlzV2VpcmQocywwLGIsayxuKSkgcHJpbnRmKCJ3ZWlyZFxuIik7CgkJCWVsc2UgcHJpbnRmKCJub3Qgd2VpcmRcbiIpOwoJCX0gZWxzZSB7CgkJCXByaW50Zigibm90IHdlaXJkXG4iKTsKCQl9Cgl9CglyZXR1cm4gMDsKfQ==