#include<stdio.h>
#include<math.h>

int main() {
    int n, temp ,digits = 0;
    long long sum = 0;
    
    scanf("%d", &n);
    
    if (n < 0) {
    printf("Invalid input");
    return 0;
}

temp = n;
while (temp > 0) {
    digits++;
    temp /= 10;
}

temp = n;
while (temp > 0) {
    int d = temp % 10;
    sum += (long long)pow(d, digit);
    temp /= 10;
    
}
 
  if (sum == n)
     printf("True");
     else
     printf("False");
}