#include <stdio.h>
#include <math.h>
int main (void){
  int X, a=1, b=1, c;
  scanf("%d", &X);
  while(1){
    for (a=1;a<=X;a++){
      for (b=1;b<=X;b++){
        c = pow(a, 5) - pow(b, 5);
        if(b<0){
          c = -c;
        }
        if (X==c){
          printf("%d", c);
        }
      }
    }
    break;
  }
  return 0;
}