#CCBOTPBA0000031. Số Armstrong tổng quát nhỏ (Generalized Armstrong Number)

Số Armstrong tổng quát nhỏ (Generalized Armstrong Number)

Generalized Armstrong Number

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Let d be the decimal digit count of n, with zero having one digit. Determine whether n equals the sum of each digit raised to d; use integer arithmetic.

Input

One integer n.

Output

Print YES or NO.

Subtasks

  • Subtask 1 (20%): n ≤ 999.

  • Subtask 2 (30%): n ≤ 9999.

  • Subtask 3 (50%): n ≤ 999999.

Examples

Example 1

Input:

153

Output:

YES

Explanation: 153 is the sum 1+125+27.

Example 2

Input:

100

Output:

NO

Explanation: The cubed digits of 100 sum to one, not 100.

Example 3

Input:

0

Output:

YES

Explanation: Zero has one digit and satisfies 0^1=0.