import java.io.*;

class B {

void Begin()
  {
    String input = readLine();
    while (!input.equals("0"))
    {
      if (count(input) == Long.parseLong(input))
      	System.out.println("YES");
	  else
	  	System.out.println("NO");
      input = readLine();
    }
  }

long count(String input) {
		if (input.length() == 1)
			return 1;
		else {
			long ones = 0;
			//Deal with the leftmost digit first
      if (input.charAt(0) == '1')
				ones = 1 + Long.parseLong(input.substring(1));
			else
				ones = power(input.length() - 1);
			//Deal with the rest of the digits one at a time
      for (int i = 1; i < input.length(); i++) {
				long a = 0;
				a = Long.parseLong(input.substring(0, i));
				if (input.charAt(i) > '1') a++;
				a = a * power(input.length() - i - 1);
        //If the digit is 1, it matters what comes after it
				if (input.charAt(i) == '1')
				{
					a++;
					if (input.substring(i+1).length() > 0)
						a = a + Long.parseLong(input.substring(i+1));
				}	
				ones = ones + a;
			}
			return ones;
		}
	}

	long power(int e)
	{
		long result = 1;
		for (int i=0;i<e;i++)
		{
			result = 10 * result;
		}
		return result;
	}
	
	BufferedReader b = new BufferedReader(new InputStreamReader(System.in));;

	String readLine() {
		String result = "";
		try {
			result = b.readLine();
		} catch (IOException e) {
		}
		return result;
	}

	public static void main(String args[]) {
		B myWork = new B(); // create a dynamic instance
		myWork.Begin(); // the true entry point
	}
}
