#!python3
import math

H, K, V, S = (int(x) for x in input().split())

dis = 0

while H > 0:
	V += S
	V -= max(1, math.floor(V/10))
	if V <= 0:
		H = 0
		V = 0
	else:
		if V >= K:
			H += 1
		else:
			H -= 1
		if H == 0:
			V = 0
	dis += V
	if S > 0:
		S -= 1

print(dis)
