#include <stdio.h>
int main()
{
int a[100];
int b, c, d, e, f, g, k=0;
scanf ("%d",&b);
for (c=101; c<=999; c++) {
d=b/100;
e=(b%100)/10;
f=b%10;
g=d*d*d+e*e*e+f*f*f;
if (g==c) {
printf ("%d",a[k]);
k++;
}
}
for (k=0; k<=c; k++) printf ("%d",a[k]);
}