#include <stdio.h>
int main()
{
int i,j,k,a,b;
for(a=3; a<=1500; a++){
for(i=1,j=0; i<a; i++){
if(a%i==0){
j+=i;
}
}
for(b=2; b<a; b++){
for(i=1,k=0; i<b; i++){
if( b%i==0){
k+=i;
}
}
if(j==b && k==a){
for(i=2; i<a; i++){
if(a%i==0){
}
}
for(i=2; i<b; i++){
if(b%i==0){
}
}
}
}
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIAp7CiAgaW50IGksaixrLGEsYjsKICAKICBmb3IoYT0zOyBhPD0xNTAwOyBhKyspewogIAlmb3IoaT0xLGo9MDsgaTxhOyBpKyspewogIAkgIGlmKGElaT09MCl7CiAgCSAgais9aTsKICAJICB9CiAgCX0KICAJCiAgCWZvcihiPTI7IGI8YTsgYisrKXsKICAJICBmb3IoaT0xLGs9MDsgaTxiOyBpKyspewogIAlpZiggYiVpPT0wKXsKICAJICBrKz1pOwogIAl9CiAgCSAgfQogIAkgIGlmKGo9PWIgJiYgaz09YSl7CiAgCXByaW50ZigiJWQ6MSIsYSk7CiAgCWZvcihpPTI7IGk8YTsgaSsrKXsKICAJICBpZihhJWk9PTApewogIAkgIAlwcmludGYoIislZCIsaSk7CiAgCSAgfQogIAl9CiAgCXByaW50ZigiPSVkXCIsaiIpOwogIAkKICAJcHJpbnRmKCIlZDoxIixiKTsKICAJZm9yKGk9MjsgaTxiOyBpKyspewogIAkgIGlmKGIlaT09MCl7CiAgCSAgCXByaW50ZigiKyVkIixpKTsKICAJICB9CiAgCX0KICAJcHJpbnRmKCI9JWRcblxuIixrKTsKICAJICB9CiAgCX0KICB9Cn0K