#include <iostream>  
#include<math.h>
using namespace std;  
int main(){  
   int i;
   for(i = 1000;i <= 9999;i++)
   { 
     int a = i / 1000;
     int b = i / 100 % 10;
     int c = i / 10 % 10;
     int d = i % 10;
     int e = a *10 + b;
int f = c *10 + d;
if((e + f) *(e + f)  == i){ 
   cout<<i<<endl;
}
   }
   return 0;  
  } 

/**************************************************************
	Problem: 1085
	User: admin
	Language: C++
	Result: Accepted
	Time:4 ms
	Memory:2072 kb
****************************************************************/