#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll t, n, a, b, k;
ll w1, w2;
bool check(ll x)
{
ll p = min(x, a), q = min(x, b);
ll sz = p * w1 + q * w2; // 最多上的课 x人总数
return sz >= x * k;
}
int main()
{
scanf("%lld %lld %lld %lld %lld", &t, &n, &a, &b, &k);
w1 = (n + 1) / 2, w2 = n / 2;
ll ans = 0;
ll l = 0, r = t;
while (l <= r) // 二分可通过人数
{
ll mid = (l + r) / 2;
if (check(mid))
{
ans = mid;
l = mid + 1;
}
else
r = mid - 1;
}
printf("%lld\n", ans);
return 0;
}