#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 ceil(double);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *, int *);
int main(void) {
  int wd, jap, arith, pj, pa, dj, da;
  scanf("%d%d%d%d%d", &wd, &jap, &arith, &pj, &pa);
  dj = ceil(1.0 * jap / pj);
  da = ceil(1.0 * arith / pa);
  if (dj > da) {
    printf("%d\n", wd - dj);
  } else {
    printf("%d\n", wd - da);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
call   1050 <scanf@plt>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe94(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x1c(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe72(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11c6 <main+0x96>
mov    -0x8(%rbp),%esi
sub    -0x1c(%rbp),%esi
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
jmp    11d8 <main+0xa8>
mov    -0x8(%rbp),%esi
sub    -0x20(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
call   1050 <scanf@plt>
cvtsi2sdl 0x18(%rsp),%xmm0
cvtsi2sdl 0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm0
mov    %eax,%ebx
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
cmp    %eax,%ebx
mov    0x1c(%rsp),%esi
cmovg  %ebx,%eax
sub    %eax,%esi
lea    0xe6d(%rip),%rdi
call   1040 <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 = [4 x i8] c"%d\0A\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
store i32 0, i32* %1
%9 = 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)
%10 = load i32, i32* %3
%11 = sitofp i32 %10 to double
%12 = fmul double 1.000000e+00, %11
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to double
%15 = fdiv double %12, %14
%16 = call i32 @ceil(double %15)
store i32 %16, i32* %7
%17 = load i32, i32* %4
%18 = sitofp i32 %17 to double
%19 = fmul double 1.000000e+00, %18
%20 = load i32, i32* %6
%21 = sitofp i32 %20 to double
%22 = fdiv double %19, %21
%23 = call i32 @ceil(double %22)
store i32 %23, i32* %8
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %32
27: ; preds = %0
%28 = load i32, i32* %2
%29 = load i32, i32* %7
%30 = sub nsw i32 %28, %29
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %37
32: ; preds = %0
%33 = load i32, i32* %2
%34 = load i32, i32* %8
%35 = sub nsw i32 %33, %34
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %32, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d%d%d%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\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* %2
%13 = sitofp i32 %12 to double
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to double
%16 = fdiv double %13, %15
%17 = call i32 @ceil(double %16)
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to double
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to double
%22 = fdiv double %19, %21
%23 = call i32 @ceil(double %22)
%24 = icmp sgt i32 %17, %23
%25 = load i32, i32* %1
%26 = select i1 %24, i32 %17, i32 %23
%27 = sub nsw i32 %25, %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
ret i32 0
}