Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := 5
	array := make([]float64, n)
	for i := 0; i < n; i++ {
		array[i], _ = nextFloat64()
	}

	// fmt.Println(array)
	fmt.Println(int(array[0] - math.Ceil(math.Max(array[1]/array[3], array[2]/array[4]))))
}

C++: #include<iostream>
#include<string>
using namespace std;

int main(){
	/*
	int a,b,c,d,e;

	cin >> a >> b >> c >> d >> e;

	int x;

	if(a > 0){
		x = e*(b-a);
	}
	if(a == 0){
		x = e*b + d;
	}
	if(a < 0){
		x = -c*a + e*b + d;
	}

	cout << x <<endl;
	*/

	/*
	int a,b,c,d,e,f;
	cin >> a >> b >> c >> d >> e >> f;
	int m,n;
	int x = a + b + c + d + e + f;


	
	if(e<f)
	{
		x = x - e;
		if(a<b)
		{
			if(a<c)
			{
				if(a<d)
				{
					cout << x-a << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
		else
		{
			if(b<c)
			{
				if(b<d)
				{
					cout << x-b << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
	}
	else
	{
		x = x - f;
		if(a<b)
		{
			if(a<c)
			{
				if(a<d)
				{
					cout << x-a << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
		else
		{
			if(b<c)
			{
				if(b<d)
				{
					cout << x-b << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
			else
			{
					if(c<d)
				{
					cout << x-c << endl;
				}
				else
				{
					cout << x-d << endl;
				}
			}
		}
	}
	*/
/*
	int n;
	cin >> n;
	int a;
	cin >> a;
	int max = a,min = a;
	int i = 1;
	while(i<n){
		cin >> a;
		if(a > max){
			max = a;
		}
		if(a < min){
			min = a;
		}
		i++;
	}
	cout << max << endl << min << endl;
	*/
	/*
	string s;
	cin >> s;
	int j,o,i;
	for(int i;i < s.size;i++){
		
	}
	*/
	/*
	int n;
	cin >> n;
	int A;
	int X[100000];
	int n=0;
	for(int i=0;i<n;i++){
		cin >> A;
		
	}
	*/
	/*
	int a,b,c,d,p;
	cin >> a >> b >> c >> d >> p;
	int X,Y=b;

	X = a*p;
	
	if(p>c){
		Y += d*(p-c);
	}

	if(X > Y){
		cout << Y << endl;
	}
	else{
		cout << X << endl;
	}
	*/ 

	int l,a,b,c,d;
	cin >> l >> a >> b >> c >> d;

		int Jap = a/c;
		if(a%c != 0){
			Jap += a%c;
		}
		int Math = b/d;
		if(b%d != 0){
			Math += b%d;
		}

	int day;
	if(Jap < Math) {
		day = Math;
	}

	cout << l - day << endl;

	return 0;
}

C++: #include <cstdio>
#include <utility>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define bs inline bool scan
ii(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
ii() {return in(gcu());}
bs(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bs(char &c){c=gcu();gcu();return c!=EOF;}
// bs(string &s){int c; s = "";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#undef bs
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
// vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int len(int a, int c) {
	return a / c + (bool) (a % c);
}

int main() {
	int l = in(), a = in(), b = in(), c = in(), d = in();
	out(l - max(len(a, c), len(b, d)), '\n');
}

C++: #include<iostream>
using namespace std;
int main(){
int l,a,b,c,d;
cin>>l>>a>>b>>c>>d;
cout<<l-max((a-1)/c,(b-1)/d)-1<<endl;
return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int i,l,a,b,c,d,a1,b1;
	cin>>l>>a>>b>>c>>d;
	if(a%c==0)a1=a/c;
	else if(a%c!=0)a1=a/c+1;
	if(b%d==0)b1=b/d;
	else if(b%d!=0)b1=b/d+1;
	if(a1>=b1)cout<<l-a1<<endl;
	else if(a1<b1)cout<<l-b1<<endl;
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main()
{
	int l,a,b,c,d,x,y;
	scanf("%d",&l);
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	x=0;
	y=0;
	x=a/c;
	y=b/d;
	if(a%c!=0)	x+=1;
	if(b%d!=0)	y+=1;
	if(x>y)	printf("%d\n",l-x);
	else	printf("%d\n",l-y);
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main()
{
	//??????(homework)
	int num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0,num8=0,num9=0,t=0;
	cin>>num1>>num2>>num3>>num4>>num5;
	num6=num2/num4;
	num7=num2%num4;
	if(num7!=0){
		num6=num6+1;
	}
	num8=num3/num5;
	num9=num3%num5;
	if(num9!=0){
		num8=num8+1;
	}
	if(num6<num8){
		t=num6;
		num6=num8;
		num8=t;
	}
	num9=num1-num6;
	cout<<num9;
	cout<<"\n";
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
  int days,jp,mp,jpd,mpd;
  cin >> days >> jp >> mp >> jpd >> mpd;
  if(jp / jpd > mp / mpd){
    if(jp % jpd){
      days -= jp/jpd+1;
    }
    else days -= jp/jpd;
  }
  else {
    if(mp % mpd){
      days -= mp/mpd+1;
    }
    else days -= mp/mpd;
  }
  cout << days << endl;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <stdlib.h>

using namespace std;

int main (void)
{
 int ZZZ,l,a,b,c,d,P,Q;
 cin >> l >> a >> b >> c >> d;

 if (a % c != 0)
 {
   P = (a / c) + 1;
 }
 else if (a % c == 0)
 {
	 P = a / c;
 }
 if (b % d != 0)
 {
   Q = (b / d) + 1;
 }
 else if (b % d == 0)
 {
	 Q = b / d;
 }

 if (P <= Q)
 {
	 ZZZ = Q;
 }
 else if (P > Q)
 {
	 ZZZ = P;
 }

 cout << l - ZZZ << endl;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int L, A, B, C, D;
  cin >> L >> A >> B >> C >> D;

  int ans = L;
  ans -= max((A + C - 1) / C, (B + D - 1) / D);

  cout << ans << endl;

  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;

int main() {

	//ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

	int day, koku, suu, kokud, suud;
	cin >> day >> koku >> suu >> kokud >> suud;
	cout << day - max(koku % kokud == 0 ? koku / kokud : koku / kokud + 1, koku % kokud == 0 ? suu / suud : suu / suud + 1);

	return 0;

}

C++: #include <iostream>
using namespace std;

int main(){
	int L, A, B, C, D, ans = 0;
	cin >> L >> A >> B >> C >> D;
	for(int i=0 ; i < L ; i++ ){
		if( A <= 0 && B <= 0 ){
			ans++;
		}else{
			A -= C;
			B -= D;
		}
	}
	cout << ans << endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int l, a, b, c, d;

int main(){
	cin >> l >> a >> b >> c >> d;
	int e, f;
	a%c == 0 ? e = a / c : e = a / c + 1;
	b%d == 0 ? f = b / d : f = b / d + 1;
	cout << l - max(e, f) << endl;
}