A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from x = 0 to x = a and back. Moving from the point x = 0 to x = a or from the point x = a to x = 0 is called a bus journey. In total, the bus must make k journeys.

The petrol tank of the bus can hold b liters of gasoline. To pass a single unit of distance the bus needs to spend exactly one liter of gasoline. The bus starts its first journey with a full petrol tank.

There is a gas station in point x = f. This point is between points x = 0 and x = a. There are no other gas stations on the bus route. While passing by a gas station in either direction the bus can stop and completely refuel its tank. Thus, after stopping to refuel the tank will contain b liters of gasoline.

What is the minimum number of times the bus needs to refuel at the point x = f to make k journeys? The first journey starts in the point x = 0.


-----Input-----

The first line contains four integers a, b, f, k (0 < f < a ≤ 10^6, 1 ≤ b ≤ 10^9, 1 ≤ k ≤ 10^4) — the endpoint of the first bus journey, the capacity of the fuel tank of the bus, the point where the gas station is located, and the required number of journeys.


-----Output-----

Print the minimum number of times the bus needs to refuel to make k journeys. If it is impossible for the bus to make k journeys, print -1.


-----Examples-----
Input
6 9 2 4

Output
4

Input
6 10 2 4

Output
2

Input
6 5 4 3

Output
-1



-----Note-----

In the first example the bus needs to refuel during each journey.

In the second example the bus can pass 10 units of distance without refueling. So the bus makes the whole first journey, passes 4 units of the distance of the second journey and arrives at the point with the gas station. Then it can refuel its tank, finish the second journey and pass 2 units of distance from the third journey. In this case, it will again arrive at the point with the gas station. Further, he can refill the tank up to 10 liters to finish the third journey and ride all the way of the fourth journey. At the end of the journey the tank will be empty. 

In the third example the bus can not make all 3 journeys because if it refuels during the second journey, the tanks will contain only 5 liters of gasoline, but the bus needs to pass 8 units of distance until next refueling.

Difficulty: interview

Starter code:

Solutions:
def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
a,b,f,k = map_input()
tot = a*k
s = 2*a-f
cur = 0
cnt = b
go = 0
ans = 0
while cur < tot:
	go = 1-go
	if(go == 1):
		if cnt < s and cnt < tot-cur:
			if(cnt < f):
				print(-1)
				break
			cnt = b
			ans += 1
			cnt -= (a-f)
		else: cnt -= a	
	else:
		if cnt < a+f and cnt < tot-cur:
			if(cnt < a-f):
				print(-1)
				break
			cnt = b
			ans += 1
			cnt -= (f)
		else:cnt -= a	
	cur += a
	# print(cur,cnt,ans)	
	if(cnt < 0):
		print(-1)
		break
else:
	print(ans)

a, b, f, k = [int(i) for i in input().split()]

ff = [0]

for i in range(k):
    d = f
    if i % 2 == 1:
        d = a - f
    ff.append(i * a + d)

ff.append(k * a)

stops = 0

while len(ff) > 0:
    next = 0
    if ff[0] == k * a:
        break
    while ff[next + 1] - ff[0] <= b:
        next += 1
        if ff[next] == k * a:
            break
    if next == 0:
        print("-1")
        return
    if ff[next] != k * a:
        stops += 1
        while next > 0:
            ff.pop(0)
            next -= 1
    else:
        break

print(stops)


a, b, f, k = map(int, input().split())

x = 0
g = b
for kk in range(k-1):
    #print(g)
    if kk%2==0:
        d = a + (a-f)
        if g < d:
            if g < f:
                x = -1
                break
            x += 1
            g = b - (a-f)
            if g < 0:
                x = -1
                break
        else:
            g -= a
    else:
        d = a + f
        if g < d:
            if g < a-f:
                x = -1
                break
            x += 1
            g = b - f
            if g < 0:
                x = -1
                break
        else:
            g -= a

if (k-1)%2==0:
    if g < a:
        if g < f:
            x = -1
        else:
            x += 1
            g = b - (a-f)
            if g < 0:
                x = -1
else:
    if g < a:
        if g < a-f:
            x = -1
        else:
            x += 1
            g = b - f
            if g < 0:
                x = -1

print(x)

a, b, f, k = list(map(int, input().split()))
ans = 0
c = b
if b < f:
    ans = -1
else:
    c -= f
for i in range(k):
    if ans == -1:
        break
    if i % 2 == 0:
        d = a - f
    else:
        d = f
    if i < k - 1:
        d *= 2
    if b < d:
        ans = -1
    elif c < d:
        ans += 1
        c = b
    c -= d

print(ans)


a, b, f, k = list(map(int, input().split()))
refill = b
busPos = 0
counter =0 

shouldPrint = True
while True:
    # Move to f
    busPos += f
    b -= f

    if b < 0:
        print(-1)
        shouldPrint = False
        break
    
    if (2 if k > 1 else 1) * (a - f) > b:
        b = refill
        counter += 1

    # Move to a
    busPos += (a - f)
    b -= (a - f)

    if b < 0:
        print(-1)
        shouldPrint = False
        break
    
    k -= 1
    if k == 0:
        break

    # Move back to f
    busPos -= (a - f)
    b -= (a - f)

    if b < 0:
        print(-1)
        shouldPrint = False
        break
    
    if (2 if k > 1 else 1) * f > b:
        b = refill
        counter += 1

    # Move back to start
    busPos -= f
    b -= f

    if b < 0:
        print(-1)
        shouldPrint = False
        break
    
    k -= 1
    if k == 0:
        break

if shouldPrint:
    print(counter)



a, b, f, k = map(int, input().split())

if (f > b or a - f > b) or (k > 1 and 2 * (a - f) > b) or (k > 2 and 2 * f > b):
	print(-1)
	return
cur = b
ans = 0
for i in range(k):
	if i & 1 == 0:
		if cur < f:
			cur = b - f
			ans += 1
		if cur >= a:
			cur -= a
		else:
			ans += 1
			cur = b - a + f
	else:
		if cur < a - f:
			cur = b - a + f
			ans += 1
		if cur >= a:
			cur -= a
		else:
			ans += 1
			cur = b - f
print(ans)

a, b, f, k = list(map(int, input().split()))
now = b
path = 0
ans = 0
for i in range(k):
    if path == 0:
        if i == k - 1 and now >= a:
            break
        now -= f
        if now < 0:
            print(-1)
            return
        if 2 * (a - f) <= now:
            now -= a - f
        else:
            ans += 1
            now = b - (a - f)
        path = 1
    elif path == 1:
        if i == k - 1 and now >= a:
            break
        now -= a - f
        if now < 0:
            print(-1)
            return
        if 2 * f <= now:
            now -= f
        else:
            ans += 1
            now = b - f
        path = 0
if now < 0:
    print(-1)
    return
print(ans)


from sys import stdin, stdout

a,b,f,k = list(map(int,stdin.readline().rstrip().split()))


direction = 1
tank = b
refuels=0
position=0
if b<f or b<(a-f):
    possible=False
else:
    possible = True
while k>0 and possible==True:
    if k==1 and tank>=a:
        k=0
    elif k==1:
        k=0
        refuels+=1
    elif position==0:
        position = f
        tank-=f
        direction=1
    elif position==a:
        position = f
        tank-=(a-f)
        direction=-1
    elif direction==1:
        if tank<2*(a-f):
            tank=b
            refuels+=1
            if b<2*(a-f):
                possible=False
        else:
            position = a
            direction = -1
            tank -= (a-f)
            k-=1
    elif direction==-1:
        if tank<2*f:
            refuels+=1
            tank=b
            if b<2*f:
                possible=False
        else:
            position = 0
            direction = 1
            tank -= f
            k-=1
if not possible:
    print(-1)
else:
    print(refuels)
        


from sys import stdin, stdout

a, b, f, k = map(int, stdin.readline().split())
ans, position = 0, 0
current = b
label = 1

for i in range(k):
    if not position:
        distance = a + a - f
        curd = a - f
        last = a
        oil = f
    else:
        distance = a + f
        curd = f
        last = 0
        oil = a - f
    
    if distance <= current or (a <= current and i == k - 1):
        current -= a
    elif oil <= current:
        ans += 1
        current = b - curd 
    else:
        current = -1
        
    position = last
    
    if current < 0:
        label = 0

if not label:
    stdout.write('-1')
else:
    stdout.write(str(ans))

b, max_fuel, f, k = map(int, input().split())

now_fuel = max_fuel
ans = 0

part_1 = f
part_2 = b - f

now_fuel -= part_1
if now_fuel < 0:
    print('-1')
    return

while k != 0:
    if k > 1:
        if now_fuel < part_2 * 2:
            ans += 1
            now_fuel = max_fuel
        now_fuel -= part_2 * 2
        k -= 1
        if now_fuel < 0:
            print('-1')
            return
    else:
        if now_fuel < part_2:
            ans += 1
            now_fuel = max_fuel
        now_fuel -= part_2
        k -= 1
        if now_fuel < 0:
            print('-1')
            return
        break

    if k > 1:
        if now_fuel < part_1 * 2:
            ans += 1
            now_fuel = max_fuel
        now_fuel -= part_1 * 2
        k -= 1
        if now_fuel < 0:
            print('-1')
            return
    else:
        if now_fuel < part_1:
            ans += 1
            now_fuel = max_fuel
        now_fuel -= part_1
        k -= 1
        if now_fuel < 0:
            print('-1')
            return
        break

print(ans)

a,b,f,k=[int(i) for i in input().split()]
if (k>=3):
    if (f>b or 2*f > b or 2*(a-f) > b):
        print (-1)
    else:
        fuel=0
        fwd=1
        rem= b-f
        while (k!=1):
            if (fwd==1):
                if (rem >= 2*(a-f)):
                    rem= rem- 2*(a-f)
                else:
                    rem= b - 2*(a-f)
                    fuel+=1
                k-=1
                fwd=0
            else:
                if (rem>= 2*f):
                    rem= rem -2*f
                else:
                    rem= b-2*f
                    fuel+=1
                k-=1
                fwd=1
        if (fwd==1):
            if (rem>= (a-f)):
                print (fuel)
            else:
                print (fuel+1)
        else:
            if (rem>= f):
                print (fuel)
            else:
                print (fuel+1)
elif (k==1):
    if (f>b or (a-f)>b):
        print (-1)
    else:
        if (b>=a):
            print (0)
        else:
            print (1)
else:
    if (f>b or 2*(a-f) >b):
        print (-1)
    else:
        fuel=0
        rem=b-f
        if (rem < 2*(a-f)):
            rem = b- 2*(a-f)
            fuel+=1
        else:
            rem=rem- 2*(a-f)
        if (rem>=f):
            print (fuel)
        else:
            print (fuel+1)

a,b,f,k = map(int,input().split())
im = False
fuel = b
cnt = 0
for i in range(k):
	if(i%2 == 0):
		if(fuel - f < 0):
			im = True
			break
		if(i < k-1):
			if(fuel - (2*a-f) < 0):
				cnt += 1
				fuel = b - (a-f)
			else:
				fuel -= a
		else:
			if(fuel - a < 0):
				cnt += 1
				fuel = b - (a-f)
			else:
				fuel -= a
	else:
		if(fuel - (a-f) < 0):
			im = True
			break
		if(i < k-1):
			if(fuel - (a+f) < 0):
				cnt += 1
				fuel = b - f
			else:
				fuel -= a
		else:
			if(fuel - a < 0):
				cnt += 1
				fuel = b - f
			else:
				fuel -= a
	if(fuel < 0):
		im = True
		break

print(-1 if im else cnt)

def solve(a, b, f, k):
  cur_b = b
  cur_k = 0
  refueling_count = 0
  
  can_0f = cur_b - f >= 0
  if not can_0f:
    return refueling_count, cur_k
  else:
    cur_b -= f
  
  while cur_k < k:
    # from f to a now
    faf_path = 2*(a-f)
    can_faf = cur_b - faf_path >= 0
    can_faf_with_refueling = b - faf_path >= 0
    can_fa = cur_b - (a-f) >= 0
    can_fa_with_refueling = b- (a-f) >= 0
    if can_faf and k - cur_k > 1:
      cur_b = cur_b - faf_path
      cur_k += 1
    elif can_faf_with_refueling and k - cur_k > 1:
      refueling_count += 1
      cur_b = b - faf_path
      cur_k += 1
    elif can_fa:
      cur_k += 1
      return refueling_count, cur_k
    elif can_fa_with_refueling:
      cur_k += 1
      refueling_count += 1
      return refueling_count, cur_k
    else:
      return refueling_count, cur_k
    
    if cur_k == k:
      return refueling_count, cur_k
    
    # from f to 0 now
    f0f_path = 2*f
    can_f0f = cur_b - f0f_path >= 0
    can_f0f_with_refueling = b - f0f_path >= 0
    can_f0 = cur_b - f >= 0
    can_f0_with_refueling = b - f >= 0
    if can_f0f and k - cur_k > 1:
      cur_b = cur_b - f0f_path
      cur_k += 1
    elif can_f0f_with_refueling and k - cur_k > 1:
      refueling_count += 1
      cur_b = b - f0f_path
      cur_k += 1
    elif can_f0:
      cur_k += 1
      return refueling_count, cur_k
    elif can_f0_with_refueling:
      cur_k += 1 
      refueling_count += 1
      return refueling_count, cur_k
    else:
      return refueling_count, cur_k
  return refueling_count, cur_k
    
  
# This is so sad code
def main():
  a, b, f, k = map(int, input().split())
  
  refueling_count, cur_k = solve(a, b, f, k)
  if cur_k == k:
    print(refueling_count)
  else:
    print(-1)
main()

#python3
# utf-8

a, b, f, k = (int(x) for x in input().split())
z = 0

curr_petrol = b
curr_races_made = 0
ans = 0
z___f = f - z
f___a = a - f
if k == 1:
    if z___f > b or f___a > b:
        print(-1)
        return
elif k == 2:
    if 2 * f___a > b:
        print(-1)
        return
else:
    if 2 * z___f > b or 2 * f___a > b:
        print(-1)
        return

#direction, races_made, petrol
curr_save = None
route = [z___f, f___a, f___a, z___f]

while curr_races_made < 2 * k:
    curr_pos = curr_races_made % 4
    curr_petrol -= route[curr_pos]
    curr_races_made += 1
    if curr_petrol < 0:
        curr_petrol = b
        ans += 1
        curr_races_made = curr_save
        continue
    if curr_pos == 0 or curr_pos == 2:
        curr_save = curr_races_made

print(ans)


a,b,f,k = map(int, input().split())

ans = 0
cb = b
for i in range(k):
    if i % 2 == 0:
        if f > cb:
            print(-1)
            return
        else:
            cb -= f
            if i != k-1:
                if cb < 2*(a-f):
                    ans += 1
                    cb = b
                cb -= a-f
            else:
                if cb < a-f:
                    ans += 1
                    cb = b
                cb -= a-f
                if cb < 0:
                    print(-1)
                    return
    else:
        if a-f > cb:
            print(-1)
            return
        else:
            cb -= a-f
            if i != k-1:
                if cb < 2*f:
                    ans += 1
                    cb = b
                cb -= f
            else:
                if cb < f:
                    ans += 1
                    cb = b
                cb -= f
                if cb < 0:
                    print(-1)
                    return
print(ans)    

a,b,f,k=list(map(int,input().split()))
fuel=b-f
c,d=0,[(a-f)<<1,(f)<<1]
flag=1
for i in range(k):
    if fuel<0:
        flag=0
        break
    dis=d[i&1]*(1 if i!=k-1 else 0.5)
    if fuel<dis:
        fuel=b
        c+=1
    fuel-=dis
if fuel<0:
    flag=0
print(c if flag else "-1")



def main():
    A, B, F, K = list(map(int, input().split()))

    gas = B
    refuel = 0
    i = 1
    while i <= K:
        if i % 2:
            gas -= F
            if gas >= 0:
                if K - i > 0 and gas < (A - F) * 2 or \
                        K - i == 0 and gas < A - F:
                    gas = B
                    refuel += 1
                gas -= A - F
        else:
            gas -= A - F
            if gas >= 0:
                if K - i > 0 and gas < F * 2 or \
                        K - i == 0 and gas < F:
                    gas = B
                    refuel += 1
                gas -= F
        if gas < 0:
            print(-1)
            return
        i += 1

    print(refuel)

main()


def main():
    a, b, f, k = list(map(int, input().split()))
    fuels = 0
    trips = 0
    pos = 0
    move = 1
    gas = b

    while trips < k:
        if gas < 0:
            print(-1)
            return
        if move == 1:
            if pos == 0:
                pos = f
                gas -= f
            elif pos == f:
                needed_gas = (a - f) if trips == k - 1 else 2 * (a - f)
                if gas < needed_gas:
                    gas = b
                    fuels += 1
                gas -= (a - f)
                pos = a
            elif pos == a:
                trips += 1
                if trips == k:
                    break
                move = -1
        elif move == -1:
            if pos == 0:
                trips += 1
                if trips == k:
                    break
                move = 1
            elif pos == f:
                needed_gas = f if trips == k - 1 else 2 * f
                if gas < needed_gas:
                    gas = b
                    fuels += 1
                pos = 0
                gas -= f
            elif pos == a:
                pos = f
                gas -= (a - f)

    print(fuels)

main()


a, b, f, k = list(map(int, input().split()))
# if 2*f > b or 2*(a - f) > b:
#     print(-1)
#     return
fuel_count = 0
fuel = b
i = 0
fuel -= f
if fuel < 0:
    print(-1)
    return
while True:
    if fuel >= a - f and i + 1 == k:
        break
    if b >= a - f and i + 1 == k:
        fuel_count += 1
        break
    elif fuel < 2*(a - f):
        fuel = b
        fuel_count += 1
        if fuel < 2*(a - f):
            print(-1)
            return
    fuel -= 2*(a - f)
    i += 1
    if i == k:
        break
    if fuel >= f and i + 1 == k:
        break
    if b >= f and i + 1 == k:
        fuel_count += 1
        break
    elif fuel < 2*f:
        fuel = b
        fuel_count += 1
        if fuel < 2*f:
            print(-1)
            return
    fuel -= 2*f
    i += 1
    if i == k:
        break
print(fuel_count)



a,b,f,k = [int(i) for i in input().split(" ")]
#p = 0
x = f
y = a - f
oil = b
result = 0
alert = 0



if k == 1:
    oil -= x
    if oil < 0:
        alert = 1
    if oil < y:
        result += 1
        oil = b
    oil -= y
    if oil < 0:
        alert = 1
else:
    oil -= x
    if oil < 0:
        alert = 1
    if oil < 2*y:
        result += 1
        oil = b

    if k == 2:
        oil -= 2*y
        if oil < 0:
            alert = 1
        if oil < x:
            result += 1
            oil = b
    else:
        oil -= 2 * y
        if oil < 0:
            alert = 1
        if oil < 2*x:
            result += 1
            oil = b

if k > 2:
    k -= 2
    for ii in range(int((k-1)/2)):
        oil -= 2*x
        if oil < 0:
            alert = 1

        if oil < 2*y:
            oil = b
            result += 1
        k -= 1
        oil -= 2*y
        if oil < 0:
            alert = 1
        if oil < 2*x:
            oil = b
            result += 1
        k -= 1
    if k == 1:
        oil -= 2 * x
        if oil < 0:
            alert = 1
        if oil < y:
            oil = b
            result += 1
    if k == 2:
        oil -= 2 * x
        if oil < 0:
            alert = 1
        if oil < 2 * y:
            oil = b
            result += 1
        oil -= 2 * y
        if oil < x:
            oil = b
            result += 1
if alert == 1:
    print(-1)
else:
    print(result)

a, b, f, k = [int(i) for i in input().split()]

ff = [0]

for i in range(k):
    d = f
    if i % 2 == 1:
        d = a - f
    ff.append(i * a + d)

ff.append(k * a)

stops = 0

while len(ff) > 0:
    next = 0
    if ff[0] == k * a:
        break
    while ff[next + 1] - ff[0] <= b:
        next += 1
        if ff[next] == k * a:
            break
    if next == 0:
        print("-1")
        return
    if ff[next] != k * a:
        stops += 1
        while next > 0:
            ff.pop(0)
            next -= 1
    else:
        break
print(stops)

a, b, f, k = [int(i) for i in input().split()]

##tank = b
##journeys = 0
##refuels = 0
##current = 0
##while(journeys != k):
##    print("current = %d, tank = %d, refuels = %d, journeys = %d" % (current, tank, refuels, journeys))
##    if (tank // a >= k):
##        print(refuels)
##        return
        
##    if current == 0:
##        if tank >= a + (a-f):
##            tank -= a
##        elif tank >= f and b >= a-f:
##            refuels += 1
##            tank = b-(a-f)
##        else:
##            break
##        
##        current = a
##        
##    elif current == a:
##        if tank >= a + f:
##            tank -= a
##        elif tank >= a-f and b >= f:
##            refuels += 1
##            tank = b-f
##        else:
##            break
##        
##        current = 0
##
##    journeys += 1

if b < f:
    print(-1)
    return

journeys = 0
previous = 0
refuels1 = 0
tank = b-f
while(journeys != k): ## necessary? while(True) ?
    if previous == 0:
        if tank >= a-f + a*(k-journeys-1):
            print(refuels1)
            return
        if b >= a-f + a*(k-journeys-1):
            print(refuels1+1)
            return
        if tank >= 2*(a-f):
            tank -= 2*(a-f)
        elif b >= 2*(a-f):
            refuels1 += 1
            tank = b - 2*(a-f)
        else:
            print(-1)
            return
        
        journeys += 1
        previous = a
        
    if previous == a:
        if tank >= f + a*(k-journeys-1):
            print(refuels1)
            return
        if b >= f + a*(k-journeys-1):
            print(refuels1+1)
            return
        if tank >= 2*f:
            tank -= 2*f
        elif b >= 2*f:
            refuels1 += 1
            tank = b-2*f
        else:
            print(-1)
            return
        
        journeys += 1
        previous = 0

if journeys == k:
    print(refuels1)
else:
    print(-1)

##journeys = 0
##previous = 0
##refuels2 = 1
##tank = b
##cant2 = False
##while(journeys != k):
##    if previous == 0:
##        if tank >= a-f + a*(k-journeys-1):
##            break
##        if tank >= 2*(a-f):
##            tank -= 2*(a-f)
##        elif b >= 2*(a-f):
##            refuels2 += 1
##            tank = b - 2*(a-f)
##        else:
##            cant2 = True
##            break
##        
##        journeys += 1
##        previous = a
##        
##    if previous == a:
##        if tank >= f + a*(k-journeys-1):
##            break
##        if tank >= 2*f:
##            tank -= 2*f
##        elif b >= 2*f:
##            refuels2 += 1
##            tank = b-2*f
##        else:
##            cant2 = True
##            break
##        
##        journeys += 1
##        previous = 0
##
##if cant1 and not cant2:
##    print(refuels2)
##elif not cant1 and cant2:
##    print(refuels1)
##elif cant1 and cant2:
##    print(-1)
##else:
##    print(min(refuels1, refuels2))



def solve():

    a, b, f, k = [int(st) for st in input().split(" ")]

    fuel = b
    location = 0
    direction = "right"
    fueled = 0

    journeypassed = 0
    while journeypassed < k:

        #print("location:", location, ", fuel:", fuel, ", "+direction)

        if location == 0:
            if fuel < f:
                return -1
            fuel -= f
            location = f
            direction = "right"

        elif location == a:
            if fuel < a-f:
                return -1
            fuel -= a-f
            location = f
            direction = "left"

        elif location == f:
            
            if k - journeypassed <= 1:
                if direction == "left":
                    if fuel < f:
                        fuel = b
                        fueled += 1
                    if fuel < f:
                        return -1
                    fuel -= f
                    location = 0
                    direction = "right"
                else:
                    if fuel < a-f:
                        fuel = b
                        fueled += 1
                    if fuel < a-f:
                        return -1
                    fuel -= a-f
                    location = a
                    direction = "left"
                    
            else:
                if direction == "left":
                    if fuel < 2*f:
                        fuel = b
                        fueled += 1
                    if fuel < 2*f:
                        return -1
                    fuel -= 2*f
                    direction = "right"
                else:
                    if fuel < 2*(a-f):
                        fuel = b
                        fueled += 1
                    if fuel < 2*(a-f):
                        return -1
                    fuel -= 2*(a-f)
                    direction = "left"
                    
            journeypassed += 1
                    

    return fueled

print(solve())


a,b,f,k=list(map(int,input().split()))
i=0
bi=b
ans=0
while i<k:
    if f>bi:
        print(-1)
        return
    bi-=f
    if k-i==1:
        if a-f>bi:
            bi=b
            ans+=1
        if a-f>b:
            print(-1)
            return
        break
    i+=1
    if 2*(a-f)>bi:
        bi=b
        ans+=1
    if 2*(a-f)>b:
        print(-1)
        return
    bi-=2*(a-f)
    if k-i==1:
        if f>bi:
            bi=b
            ans+=1
        break
    if 2*f>bi:
        bi=b
        ans+=1
    if 2*f>b:
        print(-1)
        return
    bi-=f
    i+=1
print(ans)
    


import sys
def solve():
	end,full,real_mid,times = map(int,sys.stdin.readline().split())

	oil = full
	cnt = 0
	for i in range(times):
		if i % 2 == 0:
			mid = real_mid
		else:
			mid = end - real_mid

		if mid > oil:
			return -1

		oil -= mid

		if i != times - 1:
			if (end - mid) * 2 > full:
				return -1
			if (end - mid) * 2 > oil:
				oil = full
				cnt += 1
		else:
			if end - mid > full:
				return -1
			if end - mid > oil:
				oil = full
				cnt += 1
		oil -= end - mid
	return cnt

print(solve())