#include using namespace std; int main() { int h, k, v, s; cin >> h >> k >> v >> s; int ret = 0; while(h > 0) { v += s; v -= max(1, v/10); if(v <= 0) { h = 0; v = 0; } else if(v >= k) { h++; } else { h--; if(h == 0) v = 0; } ret += v; if(s > 0) s--; } cout << ret << "\n"; }