#include #define INF 2147483647 #define INF_LL 9223372036854775807 #define MOD 1000000007 using namespace std; typedef long long int ll; typedef unsigned long long int ull; int main() { int A, B, C, D; cin >> A >> B >> C >> D; int ans = 0; while (1) { if (A == 0 || B == 0 || D == 0)break; if (B >= C && D >= C+1) { B -= C; A--; ans++; D -= C + 1; continue; } break; } cout << ans << endl; }