Skip to main content
Back to problems
Codeforces
Easy
Math
Number Theory
Sorting
Lucky Division

Determine whether a number is divisible by at least one lucky number made only of digits 4 and 7.

Acceptance 0%
Problem Statement

Lucky Division

A positive integer is called lucky if every digit in its decimal representation is either 4 or 7.

Given an integer n, decide whether it is divisible by at least one lucky number.

If such a lucky divisor exists, the answer is YES; otherwise, the answer is NO.

A number itself may be lucky, and it may also have a smaller lucky divisor.

Input Format

  • A single integer n.

Output Format

  • Print YES if n has at least one lucky divisor.
  • Otherwise print NO.

Constraints

  • 1n10001 \le n \le 1000
Examples
Sample cases returned by the problem API.

Example 1

Input

47

Output

YES

Explanation

47 is itself a lucky number, so it divides 47.

Example 2

Input

16

Output

YES

Explanation

16 is divisible by 4, and 4 is a lucky number.

Show 1 more example

Example 3

Input

17

Output

NO

Explanation

No lucky number divides 17.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.