while 1: a,b=input().split();m=0 for c in a:m+=int(c);t=str(m%10)==b[:1];b=b[t:];m*=1-t print(b+m%10*a and'NO'or'YES')