#include <stdio.h>
main()
{
	int a,b,c,d,e,f,g,h,i,j,n;
	scanf("%d",&n);
	a=n%10;
	b=n/10%10;
	c=n/100%10;
	d=n/1000%10;
	e=n/10000%10;
	f=n/100000%10;
	g=n/1000000%10;
	h=n/10000000%10;
	i=n/100000000%10;
	d=a+b+c+d+e+f+g+h+i;
	if(n%d==0) printf("YES");
		else printf("NO");
}
