#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int n;
int mi(int m)
{
int a=1;
for (int i=0;i<n;i++) {
a=a*m;
}
return a;
}
int main()
{ cin >> n;
int max=mi(10);
int min=max/10;
int n1, n2, n3, n4, n5, n6;
for (int i=min;i<max;i++) {
n1=i%10;
n2=(i/10)%10;
n3=(i/100)%10;
n4=(i/1000)%10;
n5=(i/10000)%10;
n6=(i/100000);
int he=mi(n1)+mi(n2)+mi(n3)+mi(n4)+mi(n5)+mi(n6);
if (i==he)
cout << he << endl;
}
return 0;
}
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int n;
int mi(int m)
{
int a=1;
for (int i=0;i<n;i++) {
a=a*m;
}
return a;
}
int main()
{ cin >> n;
int max=mi(10);
int min=max/10;
int n1, n2, n3, n4, n5, n6;
for (int i=min;i<max;i++) {
n1=i%10;
n2=(i/10)%10;
n3=(i/100)%10;
n4=(i/1000)%10;
n5=(i/10000)%10;
n6=(i/100000);
int he=mi(n1)+mi(n2)+mi(n3)+mi(n4)+mi(n5)+mi(n6);
if (i==he)
cout << he << endl;
}
return 0;
}