#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);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *, int *);
int main() {
  int k, l, m, n, d, undamaged = 0, counted, count;
  scanf("%d%d%d%d%d", &k, &l, &m, &n, &d);
  for (count = 1; count <= d; count++) {
    if (count % n == 0 || count % m == 0 || count % k == 0 || count % l == 0)
      continue;
    else
      undamaged++;
  }
  printf("%d", d - undamaged);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
call   1040 <scanf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11ca <main+0xaa>
mov    -0x24(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
je     11a9 <main+0x89>
mov    -0x24(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
je     11a9 <main+0x89>
mov    -0x24(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     11a9 <main+0x89>
mov    -0x24(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11ae <main+0x8e>
jmp    11bc <main+0x9c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bc <main+0x9c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115d <main+0x3d>
mov    -0x18(%rbp),%esi
sub    -0x1c(%rbp),%esi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11ba <main+0x9a>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%r9d
mov    0x1c(%rsp),%r10d
mov    0x18(%rsp),%r11d
mov    %esi,%ebx
neg    %ebx
xor    %r8d,%r8d
mov    $0x1,%ecx
jmp    118e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rbx,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x1,%eax
je     11bd <main+0x9d>
mov    %ecx,%eax
cltd
idiv   %edi
test   %edx,%edx
je     1180 <main+0x60>
mov    %ecx,%eax
cltd
idiv   %r9d
test   %edx,%edx
je     1180 <main+0x60>
mov    %ecx,%eax
cltd
idiv   %r10d
test   %edx,%edx
je     1180 <main+0x60>
mov    %ecx,%eax
cltd
idiv   %r11d
cmp    $0x1,%edx
sbb    $0xffffffff,%r8d
jmp    1180 <main+0x60>
xor    %r8d,%r8d
sub    %r8d,%esi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"%d%d%d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4, i32* %5)
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 1
br i1 %13, label %39, label %14
14: ; preds = %0
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = load i32, i32* %1
%18 = load i32, i32* %2
br label %19
19: ; preds = %14, %35
%20 = phi i32 [ 1, %14 ], [ %37, %35 ]
%21 = phi i32 [ 0, %14 ], [ %36, %35 ]
%22 = srem i32 %20, %15
%23 = icmp eq i32 %22, 0
br i1 %23, label %35, label %24
24: ; preds = %19
%25 = srem i32 %20, %16
%26 = icmp eq i32 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %24
%28 = srem i32 %20, %17
%29 = icmp eq i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %27
%31 = srem i32 %20, %18
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i32
%34 = add nsw i32 %21, %33
br label %35
35: ; preds = %30, %19, %24, %27
%36 = phi i32 [ %21, %19 ], [ %21, %24 ], [ %21, %27 ], [ %34, %30 ]
%37 = add nuw i32 %20, 1
%38 = icmp eq i32 %20, %12
br i1 %38, label %39, label %19
39: ; preds = %35, %0
%40 = phi i32 [ 0, %0 ], [ %36, %35 ]
%41 = sub nsw i32 %12, %40
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %41)
ret i32 0
}