#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  if (n % 4 == 0 || n % 7 == 0 || n % 44 == 0 || n % 47 == 0 || n % 77 == 0 ||
      n % 444 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0 ||
      n % 744 == 0 || n % 747 == 0 || n % 777 == 0)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x2c,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x2f,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x4d,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x1bc,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x1bf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x1da,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x1dd,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x2e8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x2eb,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     122f <main+0x10f>
mov    -0x8(%rbp),%eax
mov    $0x309,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1240 <main+0x120>
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x12c>
lea    0xdc1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
imul   $0xb6db6db7,%eax,%r8d
add    $0x12492492,%r8d
imul   $0xba2e8ba3,%eax,%r14d
add    $0xba2e8b8,%r14d
ror    $0x2,%r14d
imul   $0x677d46cf,%eax,%r9d
add    $0x2b93105,%r9d
imul   $0x3f2b3885,%eax,%r10d
add    $0x1a98ef6,%r10d
imul   $0xdb195e8f,%eax,%esi
add    $0x1273508,%esi
ror    $0x2,%esi
imul   $0xd9a0ee3f,%eax,%r11d
imul   $0xcb125ce5,%eax,%ebx
add    $0x8a42f8,%ebx
ror    %ebx
add    $0x494e75,%r11d
imul   $0xf905e75,%eax,%r15d
add    $0x44b22e,%r15d
imul   $0x3f4fd3f5,%eax,%edx
add    $0x1605810,%edx
ror    $0x3,%edx
imul   $0x5a2195c3,%eax,%ebp
add    $0x2bddba,%ebp
imul   $0xfaba7b39,%eax,%ecx
add    $0x2a2c26,%ecx
cmp    $0x54584d,%ecx
lea    0xe21(%rip),%rcx
lea    0xe17(%rip),%rdi
cmovb  %rcx,%rdi
cmp    $0x57bb75,%ebp
cmovb  %rcx,%rdi
cmp    $0x581605,%edx
cmovb  %rcx,%rdi
cmp    $0x89645d,%r15d
cmovb  %rcx,%rdi
cmp    $0x8a42f9,%ebx
cmovb  %rcx,%rdi
cmp    $0x929ceb,%r11d
cmovb  %rcx,%rdi
cmp    $0x939a85,%esi
cmovb  %rcx,%rdi
cmp    $0x3531ded,%r10d
cmovb  %rcx,%rdi
cmp    $0x572620b,%r9d
cmovb  %rcx,%rdi
cmp    $0x5d1745d,%r14d
cmovb  %rcx,%rdi
cmp    $0x24924925,%r8d
cmovb  %rcx,%rdi
test   $0x3,%al
cmove  %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"YES\0A\00"
@.str.2 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %51, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = srem i32 %8, 7
%10 = icmp eq i32 %9, 0
br i1 %10, label %51, label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = srem i32 %12, 44
%14 = icmp eq i32 %13, 0
br i1 %14, label %51, label %15
15: ; preds = %11
%16 = load i32, i32* %2
%17 = srem i32 %16, 47
%18 = icmp eq i32 %17, 0
br i1 %18, label %51, label %19
19: ; preds = %15
%20 = load i32, i32* %2
%21 = srem i32 %20, 77
%22 = icmp eq i32 %21, 0
br i1 %22, label %51, label %23
23: ; preds = %19
%24 = load i32, i32* %2
%25 = srem i32 %24, 444
%26 = icmp eq i32 %25, 0
br i1 %26, label %51, label %27
27: ; preds = %23
%28 = load i32, i32* %2
%29 = srem i32 %28, 447
%30 = icmp eq i32 %29, 0
br i1 %30, label %51, label %31
31: ; preds = %27
%32 = load i32, i32* %2
%33 = srem i32 %32, 474
%34 = icmp eq i32 %33, 0
br i1 %34, label %51, label %35
35: ; preds = %31
%36 = load i32, i32* %2
%37 = srem i32 %36, 477
%38 = icmp eq i32 %37, 0
br i1 %38, label %51, label %39
39: ; preds = %35
%40 = load i32, i32* %2
%41 = srem i32 %40, 744
%42 = icmp eq i32 %41, 0
br i1 %42, label %51, label %43
43: ; preds = %39
%44 = load i32, i32* %2
%45 = srem i32 %44, 747
%46 = icmp eq i32 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = load i32, i32* %2
%49 = srem i32 %48, 777
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %47, %43, %39, %35, %31, %27, %23, %19, %15, %11, %7, %0
%52 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %55
53: ; preds = %47
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %53, %51
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [3 x i8] c"NO\00"
@str.3 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = and i32 %4, 3
%6 = icmp eq i32 %5, 0
%7 = srem i32 %4, 7
%8 = icmp eq i32 %7, 0
%9 = or i1 %6, %8
%10 = srem i32 %4, 44
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 true, i1 %11
%13 = srem i32 %4, 47
%14 = icmp eq i32 %13, 0
%15 = select i1 %12, i1 true, i1 %14
%16 = srem i32 %4, 77
%17 = icmp eq i32 %16, 0
%18 = select i1 %15, i1 true, i1 %17
%19 = srem i32 %4, 444
%20 = icmp eq i32 %19, 0
%21 = select i1 %18, i1 true, i1 %20
%22 = srem i32 %4, 447
%23 = icmp eq i32 %22, 0
%24 = select i1 %21, i1 true, i1 %23
%25 = srem i32 %4, 474
%26 = icmp eq i32 %25, 0
%27 = select i1 %24, i1 true, i1 %26
%28 = srem i32 %4, 477
%29 = icmp eq i32 %28, 0
%30 = select i1 %27, i1 true, i1 %29
%31 = srem i32 %4, 744
%32 = icmp eq i32 %31, 0
%33 = select i1 %30, i1 true, i1 %32
%34 = srem i32 %4, 747
%35 = icmp eq i32 %34, 0
%36 = select i1 %33, i1 true, i1 %35
%37 = srem i32 %4, 777
%38 = icmp eq i32 %37, 0
%39 = select i1 %36, i1 true, i1 %38
%40 = select i1 %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%41 = call i32 @puts(i8* dereferenceable(1) %40)
ret i32 0
}