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