#include<stdio.h>
long long ipow (int base,int exp){
    long long res=1;
    for(inti=0;i<exp;;i++)res *=base;
    return res;
}
int main(){
    int n;
    if (scanf("%d",&n) !=1)
    return 0;
    if(n<=0){
        printf("Invalid input");
        return 0;
    }
    int temp =n;
    int digits = 0;
    if (temp==0)
    digits=1;
    else{
        while(temp>0){
            digits++;
            temp /= 10
        }
    }
    temp=n;
    long long sum =0;
    while(temp>0){
        int digit=temp%10;
        sum += ipow(digit,digits);
        temp /=10;
    }
    if(sum ==n){
        printf("True");
    }
    else{
        printf("False");
    }
    return 0;
}