#include<stdio.h>

int main()
{
    long long a,b,c,d,h,i,k,j,m,c1,c2,c3,c4,c5,c6,c7,c8,c9;
    
   scanf("%lld",&a);
   c1=a%10;
   c2=a/10%10;
   c3=a/100%10;
   c4=a/1000%10;c5=a/10000%10;c6=a/100000%10;c7=a/1000000%10;c8=a/10000000%10;c9=a/100000000%10;
   k=c1+c2+c3+c4+c5+c6+c7+c8+c9;
       if(a%k==0)
       printf("YES\n");
else printf("NO\n");
}
