#include using namespace std; typedef long long ll; typedef pair llp; typedef pair ii; typedef vector vi; typedef vector vvi; typedef vector vii; typedef vector vvii; #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) int main(int argc, char **argv) { //freopen("input", "r", stdin); //freopen("output", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); int p, d, m, s; cin >> p >> d >> m >> s; int cost = p + d; int cnt = 0; while (s) { if (cost > m) cost -= d; if (cost < m) cost = m; if (cost <= s) { s -= cost; cnt++; } else break; } cout << cnt << endl; return 0; }