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