Under construction

Still being built. Things may change

Yujin Number

Interview

Time limit2sMemory limit128 MB

Summary
Given an integer up to about 2.1 billion, determine whether some split of its digits into a left and right part yields equal digit products.
Level

Easy2 of 10

Topics
String, Brute force, Implementation
Solved
No attempts yet

Problem

Write a positive integer in decimal notation. If its digits can be split at one position so that the product of the digits on the left equals the product of the digits on the right, call the number a Yujin number.

The number 1221 can be split into 12 and 21, and 1 * 2 = 2 * 1, so it is a Yujin number. The number 1236 is also a Yujin number because it can be split into 123 and 6, and 1 * 2 * 3 = 6. However, 1234 is not a Yujin number.

When splitting the number, the original order of digits must be preserved, and both parts must contain at least one digit. The number 12345 has exactly four possible splits: 1-2345, 12-345, 123-45, and 1234-5.

Given a positive integer N, determine whether N is a Yujin number.

Input

The first line contains a positive integer N. N is at most 2,147,483,647.

Output

Print YES if N is a Yujin number. Otherwise, print NO.

Examples5

  1. Example 1

    Input
    1236
    
    Expected output
    YES
    
  2. Example 2

    Input
    1
    
    Expected output
    NO
    
  3. Example 3

    Input
    1221
    
    Expected output
    YES
    
  4. Example 4

    Input
    4729382
    
    Expected output
    NO
    
  5. Example 5

    Input
    42393338
    
    Expected output
    YES