#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+CgppbnQgbWFpbigpCnsKIGludCBpLGosayxhLGI7CiAKIGZvcihhPTM7IGE8PTE1MDA7IGErKyl7CiAgZm9yKGk9MSxqPTA7IGk8YTsgaSsrKXsKICAJaWYoYSVpPT0wKXsKICAJais9aTsKICAJfQogIH0KICAKICBmb3IoYj0yOyBiPGE7IGIrKyl7CiAgCWZvcihpPTEsaz0wOyBpPGI7IGkrKyl7CiAgaWYoIGIlaT09MCkgewogIAlrKz1pOwogIH0KICAJfQogIAlpZihqPT1iICYmaz09YSl7CiAgcHJpbnRmKCIlZDoxIixhKTsKICBmb3IoaT0yOyBpPGE7IGkrKyl7CiAgCWlmKGElaT09MCkgewogIAkgIHByaW50ZigiKyVkIixpKTsKICAJfQogIH0KICBwcmludGYoIj0lZFxuIixpKTsKICAKICBwcmludGYoIj0lZDoxIixiKTsKICBmb3IoaT0yOyBpPGI7IGkrKyl7CiAgCWlmKGIlaT09MCl7CiAgCSAgcHJpbnRmKCIrJWQiLGkpOwogIAl9CiAgfQogIHByaW50ZigiPSVkXG5cbiIsayk7CiAgCX0KICB9CiB9Cn0K