#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
int main()
{
	int N,a,b,c,d,e,f,g,h,i,sum;
	cin>>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;
	sum=a+b+c+d+e+f+g+h+i;
	if(N%sum==0)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	return 0;
}