Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated.

Kolya is hungry, so he went to the nearest milk shop. In 2084 you may buy kefir in a plastic liter bottle, that costs a rubles, or in glass liter bottle, that costs b rubles. Also, you may return empty glass bottle and get c (c < b) rubles back, but you cannot return plastic bottles.

Kolya has n rubles and he is really hungry, so he wants to drink as much kefir as possible. There were no plastic bottles in his 1984, so Kolya doesn't know how to act optimally and asks for your help.


-----Input-----

First line of the input contains a single integer n (1 ≤ n ≤ 10^18) — the number of rubles Kolya has at the beginning.

Then follow three lines containing integers a, b and c (1 ≤ a ≤ 10^18, 1 ≤ c < b ≤ 10^18) — the cost of one plastic liter bottle, the cost of one glass liter bottle and the money one can get back by returning an empty glass bottle, respectively.


-----Output-----

Print the only integer — maximum number of liters of kefir, that Kolya can drink.


-----Examples-----
Input
10
11
9
8

Output
2

Input
10
5
6
1

Output
2



-----Note-----

In the first sample, Kolya can buy one glass bottle, then return it and buy one more glass bottle. Thus he will drink 2 liters of kefir.

In the second sample, Kolya can buy two plastic bottle and get two liters of kefir, or he can buy one liter glass bottle, then return it and buy one plastic bottle. In both cases he will drink two liters of kefir.

Difficulty: MEDIUM_HARD
Tags: Mathematics

Implementation

Starter code:

Solutions:
def main():
	(n, a, b, c) = (int(input()) for _ in range(4))
	x = 0 if n < b else (n - c) // (b - c)
	print(max(n // a, x + (n - x * (b - c)) // a))
main()


from math import ceil
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c < a:
	if n < b:
		if n < a:
			print(0)
		else:
			print(n // a)
	else:
		if b > 100000000000000000:
			count = n // (b - c) + 1 - b // (b - c)
		elif b // (b - c) * (b - c) + n % (b - c) >= b:
			count = n // (b - c) + 1 - (b // (b - c) * (b - c) + n % (b - c)) // (b - c)
		else:
			count = n // (b - c) + 1 - (ceil(b / (b - c)) * (b - c) + n % (b - c)) // (b - c)
		if a <= b:
			if a < n:
				print(count + (n - (b - c) * count) // a)
			else:
				print(count)
		else:
			print(count)
elif n < a:
	print(0)
else:
	print(n // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = [0, 0, 0]
ans[0] = n // a
if n >= b:
	ans[1] = (n + (n - b) // (b - c) * c) // b + ((n + (n - b) // (b - c) * c) % b + c) // a
print(max(ans))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if a <= b - c:
	print(n // a)
	exit()
ans = 0
if n >= b:
	ans += (n - c) // (b - c)
n = n - (b - c) * ans
ans += n // a
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
glass = 1 + (n - b) // (b - c) + (n - (1 + (n - b) // (b - c)) * (b - c)) // a if n >= b else 0
print(max(n // a, glass))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
inc = b - c
ans = 0
if a > inc and n >= b:
	ans = (n - b) // inc + 1
	n -= ans * inc
ans += n // a
print(ans)


tot = int(input())
plas = int(input())
glass = int(input())
rem = int(input())
c = 0
if tot < glass and tot < plas:
	print(0)
elif glass - rem >= plas or tot < glass:
	c = tot // plas + tot % plas // glass
	print(c)
else:
	tot -= rem
	glass -= rem
	c = tot // glass
	rem = rem + tot % glass
	c += rem // plas
	print(c)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n < a and n < b:
	print(0)
	exit(0)
ans = 0
if b - c > a or n < b:
	ans += n // a
	n %= a
	if n >= b:
		ans += (n - b) // (b - c) + 1
	print(ans)
else:
	ans += (n - b) // (b - c) + 1
	n -= ans * (b - c)
	ans += n // a
	print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if c >= n:
	ans = n // a
else:
	ans += (n - c) // min(b - c, a) + ((n - c) % min(b - c, a) + c) // a
print(ans)


def main():
	n = int(input())
	a = int(input())
	b = int(input())
	c = int(input())
	plastic_cost = a
	glass_cost = b - c
	plastic_litre = n // plastic_cost
	glass_litre = (n - c) // glass_cost if n > c else 0
	if plastic_cost < glass_cost:
		print(plastic_litre)
	else:
		remaining_ruble = n - glass_litre * glass_cost
		remaining_plastic_litre = remaining_ruble // plastic_cost
		print(glass_litre + remaining_plastic_litre)
main()


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def power_set(L):
	cardinality = len(L)
	n = 2 ** cardinality
	powerset = []
	for i in range(n):
		a = bin(i)[2:]
		subset = []
		for j in range(len(a)):
			if a[-j - 1] == '1':
				subset.append(L[j])
		powerset.append(subset)
	powerset_orderred = []
	for k in range(cardinality + 1):
		for w in powerset:
			if len(w) == k:
				powerset_orderred.append(w)
	return powerset_orderred

def fastPlrintNextLines(a):
	print('\n'.join(map(str, a)))

def sortByFirstAndSecond(A):
	A = sorted(A, key=lambda x: x[0])
	A = sorted(A, key=lambda x: x[1])
	return list(A)
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def solve():
	n = ii()
	a = ii()
	b = ii()
	c = ii()
	res = 0
	if b - c < a and b <= n:
		res = (n - b) // (b - c)
		left = n - res * (b - c)
		if left >= b:
			left -= b - c
			res += 1
		res += max(left // b, left // a)
	else:
		res = n // a
	print(max(res, 0))
t = 1
for _ in range(t):
	solve()


n = int(input())
a = int(input())
b = int(input())
c = int(input())
cnt = a
cnt = 0
cnt1 = a
cnt1 = int(n // a)
if n < b:
	while n // b > 0:
		cnt += n // b
		n -= n // b * b - n // b * c
	cnt += n // a
	print(int(max(cnt, cnt1)))
else:
	n -= b
	cnt += n // (b - c)
	n %= b - c
	n += b
	while n // b > 0:
		cnt += n // b
		n -= n // b * b - n // b * c
	cnt += n // a
	print(int(max(cnt, cnt1)))


import sys
n = int(input())
a = int(input())
b = int(input())
c = int(input())
count = 0
if b - c < a:
	if n < b:
		if n < a:
			print(0)
			exit()
		else:
			print(n // a)
			exit()
	elif b // (b - c) * (b - c) + n % (b - c) >= b:
		count = n // (b - c) + 1 - (b // (b - c) * (b - c) + n % (b - c)) // (b - c)
	else:
		count = n // (b - c) + 1 - ((b // (b - c) + 1) * (b - c) + n % (b - c)) // (b - c)
	if a <= b:
		if a < n:
			print(count + (n - (b - c) * count) // a)
			exit()
		else:
			print(count)
			exit()
	else:
		print(count)
elif n < a:
	print(0)
else:
	print(n // a)


r = lambda : int(input())
(n, a, b, c) = (r(), r(), r(), r())
(ans, d) = (0, b - c)
if d < a and n > c:
	ans = (n - c) // d
	n -= ans * d
ans += n // a
print(ans)


(n, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
x = (n - c) // (b - c)
if c > n:
	x = 0
y = n - x * (b - c)
x += y // a
print(max(x, n // a))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
k = 0
if n >= b:
	k = (n - b) // (b - c) + 1
print(max(n // a, k + (n - (b - c) * k) // a))


(n, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
plas = a
glas = b - c
if plas <= glas:
	print(int(n // plas))
elif n >= b:
	k = int((n - b) // (b - c)) + 1
	n -= (b - c) * k
	if n >= 0:
		print(k + int(n // plas))
	else:
		print(k)
else:
	print(int(n // plas))


def __starting_point():
	r = int(input())
	a = int(input())
	b = int(input())
	c = int(input())
	d = 0
	if b - c >= a:
		d += r // a
		r = r % a
	else:
		if r >= b:
			t = (r - b + 1) // (b - c)
			d += t
			r -= t * (b - c)
			if r >= b:
				r -= b - c
				d += 1
		d += r // a
	print(d)
__starting_point()


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c or b > n:
	print(n // a)
else:
	ans = (n - c) // (b - c)
	ans += ((n - c) % (b - c) + c) // a
	print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
cost1 = a
cost2 = b - c
if cost1 <= cost2:
	print(n // cost1)
else:
	r = 0
	if n >= b:
		t = (n - b + 1) // cost2
		r += t
		n -= t * cost2
		if n >= b:
			n -= cost2
			r += 1
	r += n // cost1
	print(r)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
a2 = b - c
if a2 >= a or n < b:
	print(n // a)
else:
	ans = 0
	ans += (n - c) // (b - c)
	n -= ans * (b - c)
	ans += n // a
	print(ans)


def kefir(n, a, b, c):
	if a <= b - c:
		return n // a
	if n >= c:
		(s, k) = divmod(n - c, b - c)
		n = c + k
	else:
		s = 0
	s += n // a
	return s
n = int(input())
a = int(input())
b = int(input())
c = int(input())
print(kefir(n, a, b, c))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n < a and n < b:
	print(0)
elif n >= b and b - c <= a:
	t = (n - b) // (b - c)
	t += 1
	n -= t * (b - c)
	print(t + n // a)
else:
	print(n // a)


(n, a, b, c) = [int(input()) for _ in range(4)]
if a < b - c or n < b:
	print(n // a)
else:
	k = 1 + (n - b) // (b - c)
	print(k + (n - k * b + k * c) // a)


(n, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
l = 0
if b - c < a and n >= c:
	l = (n - c) // (b - c)
	n -= l * (b - c)
l += n // a
print(l)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
k = n // a
l = 0
if n < b:
	print(n // a)
elif n - b + 1 < b - c:
	n -= b - c
	l += 1
	print(max(k, l + n // a))
else:
	l = (n - b) // (b - c) + 1
	n -= (b - c) * l
	print(max(k, l + n // a))


I = lambda : int(input())
(n, a, b, c) = (I(), I(), I(), I())
m = max(n // a, (n - b) // (b - c) + 1 if b <= n else 0)
print(m + max(0, (n - m * (b - c)) // a if b <= n else 0))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c:
	print(n // a)
elif n < b:
	print(n // a)
else:
	v = (n - b) // (b - c) * (b - c)
	kol = (n - b) // (b - c)
	d = n - v
	while d >= b:
		d -= b
		d += c
		kol += 1
	kol += d // a
	print(kol)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
l = -1
r = 2 ** 228
while l + 1 < r:
	m = l + (r - l) // 2
	if n - m * d < b:
		r = m
	else:
		l = m
ans = n // a
l += 1
ans = max(ans, l + (n - l * d) // a)
ans = max(ans, l + (n - l * d) // b)
print(ans)


def seal(a, b):
	return (a + b - 1) // b
n = int(input())
a = int(input())
b = int(input())
c = int(input())
diff = b - c
a1 = 0
if n - b + 1 >= 0:
	a1 = seal(n - b + 1, diff)
	rem = n - diff * a1
	a1 += int(rem // a)
a2 = int(n // a)
print(max(a1, a2))


(N, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
ans = 0
if b - c < a and N >= b:
	ans += (N - b) // (b - c)
	N = b + (N - b) % (b - c)
	while N >= b:
		ans += N // b
		N = N // b * c + N % b
print(ans + N // a)


x = [int(input()) for i in range(4)]
if x[1] <= x[2] - x[3] or x[0] < x[2]:
	print(x[0] // x[1])
else:
	maxx = (x[0] - x[2]) // (x[2] - x[3])
	ans = -1
	for i in range(max(0, maxx - 1000), maxx + 5):
		if (x[2] - x[3]) * (i - 1) + x[2] > x[0]:
			continue
		ans = max(ans, i + (x[0] - i * (x[2] - x[3])) // x[1])
	print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
r = b - c
x = 0
if r < a and b <= n:
	x += (n - b) // r + 1
	n -= r * x
x += n // a
print(x)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c >= a:
	print(n // a)
else:
	(l, r, m) = (-1, 10 ** 18, 0)
	while r > l + 1:
		m = (l + r) // 2
		if n - b * m + c * m < b:
			r = m
		else:
			l = m
	ans = r
	n = n - b * r + c * r
	print(ans + n // min(a, b))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
l = 0
while n >= a or n >= b:
	if n >= b and b - c < a:
		nl1 = (n - b) // (b - c)
		nl2 = n // b
		nl = max(nl1, nl2)
		l += nl
		n -= (b - c) * nl
	else:
		nl = n // a
		l += nl
		n -= a * nl
print(l)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n < a and n < b:
	cnt = 0
elif a <= b - c or n < b:
	cnt = n // a
else:
	rem = b + (n - b) % (b - c)
	cnt = (n - b) // (b - c) + max(rem // a, 1 + (rem - b + c) // a)
print(cnt)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a < b - c or n < b:
	print(n // a)
else:
	print((n - b) // (b - c) + 1 + (c + (n - b) % (b - c)) // a)


(n, a, b, c) = [int(input()) for i in range(4)]
if a <= b - c:
	print(n // a + n % a // b)
else:
	g = n // (b - c) - (b - n % (b - c) + b - c - 1) // (b - c)
	g += 1
	g = max(g, 0)
	print((n - g * (b - c)) // a + g)


(n, a, b, c) = [int(input()) for _ in (1, 2, 3, 4)]
k = max(0, (n - c) // (b - c))
print(max(n // a, k + (n - k * (b - c)) // a))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
kefir = 0
if n < a and n < b:
	print(0)
elif b - c >= a or n < b:
	print(n // a)
else:
	kefir += (n - c) // (b - c)
	n -= (n - c) // (b - c) * (b - c)
	kefir += n // a
	print(kefir)


(n, a, b, c) = [int(input()) for i in range(4)]
g = max(0, (n - c) // (b - c))
print(max(n // a, g + (n - g * (b - c)) // a))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
cnt1 = n // a
if n % a >= b:
	cnt1 = cnt1 + 1
cnt2 = 0
k = (n - b) // (b - c)
for mi in range(max(0, k - 10), k + 10, 1):
	if n - mi * (b - c) >= b:
		cnt2 = mi + 1
		cnt2 = cnt2 + (n - (mi + 1) * (b - c)) // a
print(max(cnt1, cnt2))


from collections import defaultdict
from pprint import pprint
import sys
import time
from collections import Counter
from functools import total_ordering, lru_cache
from random import randint
from sys import stderr
from typing import Union
INF = 10 ** 18 + 3
EPS = 1e-10
MAX_CACHE = 10 ** 9

def time_it(function, output=stderr):

	def wrapped(*args, **kwargs):
		start = time.time()
		res = function(*args, **kwargs)
		elapsed_time = time.time() - start
		print('"%s" took %f ms' % (function.__name__, elapsed_time * 1000), file=output)
		return res
	return wrapped

@time_it
def main():
	(n, a, b, c) = map(int, (input() for _ in range(4)))
	or_n = n
	opt1 = n // a
	opt2 = max(0, n - c) // (b - c)
	n -= opt2 * (b - c)
	opt2 += n // a
	n = or_n % a
	opt1 += max(0, n - c) // (b - c)
	res = max(opt1, opt2)
	print(res)

def set_input(file):
	global input
	input = lambda : file.readline().strip()

def set_output(file):
	global print
	local_print = print

	def print(*args, **kwargs):
		kwargs['file'] = kwargs.get('file', file)
		return local_print(*args, **kwargs)
set_input(open('input.txt', 'r') if 'MINE' in sys.argv else sys.stdin)
set_output(sys.stdout)
main()


n = int(input())
a = int(input())
b = int(input())
c = int(input())
s = 0
if a > b - c:
	if n >= b:
		s += (n - b) // (b - c) + 1
		left = n - s * (b - c)
		s += left // min(a, b)
	else:
		s = n // min(a, b)
else:
	s = n // a
print(s)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c:
	print(n // a)
	return
otv = n // (b - c)
razn = b - c
razn1 = n - b
if razn1 // razn >= 0:
	otv = razn1 // razn + 1
else:
	otv = 0
otv += (n - otv * (b - c)) // a
print(otv)


def main():
	n = int(input())
	a = int(input())
	b = int(input())
	c = int(input())
	print(solver(n, a, b, c))

def solver(n, a, b, c):
	if a < b - c:
		return n // a
	elif a > b:
		if n < b:
			return 0
		return (n - b) // (b - c) + 1
	else:
		if n < b:
			return n // a
		bs = (n - b) // (b - c) + 1
		rem = n - bs * (b - c)
		return bs + rem // a
main()


from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def digits(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def ceil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def mapin():
	return map(int, input().split())
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a > b - c:
	if n < b:
		print(n // a)
	else:
		b = b - c
		d = (n - c) // b
		e = d + (n - d * b) // a
		print(e)
else:
	ans = 0
	print(n // a)


budget = int(input())
plastic = int(input())
glass = int(input())
refund = int(input())
if glass - refund < plastic:
	ans = max((budget - refund) // (glass - refund), 0)
	budget -= ans * (glass - refund)
	ans += budget // plastic
	print(ans)
else:
	print(budget // plastic)


import math as ma
n = int(input())
m = n
a = int(input())
b = int(input())
c = int(input())
if a <= b - c:
	print(n // a)
else:
	d = (n - b) // (b - c) + 1
	n = n - d * (b - c)
	d += n // a
	print(max(max(d, 0), m // a))


import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a < b - c or b > n:
	print(math.floor(n / a))
elif n - math.floor((n - b) // (b - c)) * (b - c) >= b:
	count = math.floor((n - b) // (b - c)) + 1
	r = n - count * (b - c)
	count += math.floor(r // a)
	print(count) if count > 0 else print(math.floor(n / a))
else:
	print(math.floor((n - b) // (b - c)))


import collections
import math

def is_prime(x):
	for i in range(2, math.ceil(math.sqrt(x))):
		if x % i == 0:
			return False
	return True
n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if b - c < a:
	if b < n:
		ans += (n - b) // (b - c)
		n = b + (n - b) % (b - c)
	if b <= n:
		ans += n // b
		n = n % b + n // b * c
ans += n // a
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c:
	print(n // a)
elif n < b:
	print(n // a)
else:
	print((n - c) // (b - c) + ((n - c) % (b - c) + c) // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
if a <= d:
	print(n // a)
else:
	lb = 0
	ub = n
	while ub - lb > 1:
		mid = (ub + lb) // 2
		tmp = n - d * (mid - 1)
		if tmp >= b:
			lb = mid
		else:
			ub = mid
	ans = lb
	n -= d * lb
	ans += n // a
	print(ans)


def read_list():
	return [int(i) for i in input().split()]

def new_list(n):
	return [0 for i in range(n)]

def new_matrix(n, m=0):
	return [[0 for i in range(m)] for i in range(n)]
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a < b - c:
	print(n // a)
elif n < b:
	print(n // a)
else:
	diff = b - c
	answ = (n - b) // diff
	n -= answ * b
	n += answ * c
	if n >= b:
		n -= b
		n += c
		answ += 1
	answ += n // a
	print(max(answ, 0))


(n, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
if a <= b - c or n < b:
	print(n // a)
elif n >= b:
	(x, y) = divmod(n - b, b - c)
	print(x + 1 + (c + y) // a)


(n, a, b, c) = [int(input()) for i in range(4)]
if a > n and b > n:
	res = 0
elif b - c < a and b <= n:
	res = (n - c) // (b - c)
	n -= res * (b - c)
	res += n // a
else:
	res = n // a
print(res)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c:
	print(int(n / a))
else:
	i = 0
	if n >= b:
		i = int((n - b) // (b - c))
		n = n - i * (b - c)
	if n >= b:
		n = n - b + c
		i = i + 1
	i = i + int(n // a)
	print(i)


from sys import stdin, stdout
import sys
import random
import datetime
DEBUG = True
endl = '\n'

class Scan:

	def __init__(self):
		self.read = stdin.read
		self.input = stdin.readline

	def integer(self, count=1):
		if count == 1:
			return self._integer()
		return [self._integer() for _ in range(count)]

	def _integer(self):
		sym: str = self.read(1)
		while sym != '-' and (not sym.isdigit()):
			sym = self.read(1)
		(number, sign) = (0, -1) if sym == '-' else (int(sym), 1)
		sym: str = self.read(1)
		while sym.isdigit():
			number = number * 10 + int(sym)
			sym = self.read(1)
		return number * sign

	def array(self, func=int, sep=' '):
		if func == str:
			return input().split(sep)
		return list(map(func, input().split(sep)))

	def string(self, count=1):
		if count == 1:
			return self._string()
		return [self._string() for _ in range(count)]

	def _string(self):
		sym = self.read(1)
		while sym in ('\n', '\r', ' '):
			sym = self.read(1)
		s = str()
		while sym not in ('\n', '\r', ' '):
			s += sym
			sym = self.read(1)
		return s

class Write:

	def __lshift__(self, other):
		stdout.write(str(other))

class Number:

	def gcd(a, b):
		while b > 0:
			(a, b) = (b, a % b)
		return a

	def lcm(a, b):
		return a * b // gcd(a, b)

	def sqrt(n):
		sqrt_n = int(n ** 0.5)
		while sqrt_n * sqrt_n < n:
			sqrt_n += 1
		while sqrt_n * sqrt_n > n:
			sqrt_n -= 1
		return sqrt_n

	def sum_n(n):
		return n * (n + 1) // 2

class Constants:
	EPS = 10 ** (-9)
	INF = 10 ** 18
	MOD = 10 ** 9 + 7

def f(m, n, x, b, c):
	y = (m - 1) * (b - c)
	return n - y - b >= 0 and y + b <= x

def calc(n, x, b, c):
	(l, r) = (0, n + 1)
	while r - l > 1:
		m = l + r >> 1
		if f(m, n, x, b, c):
			l = m
		else:
			r = m
	return l

def solution(scan: Scan, write: Write):
	(n, a, b, c) = scan.integer(4)
	x = calc(n, n, b, c)
	ans = (n - (b - c) * x) // a + x
	ans = max(ans, n // a + calc(n % a, n, b, c))
	print(ans)

def main():
	queries: int = 1
	(scan, write) = (Scan(), Write())
	for _ in range(queries):
		solution(scan, write)
main()


[n, a, b, c] = list(map(int, [input() for _ in range(4)]))
s = 0
if n > c and a > b - c:
	n -= c
	s += n // (b - c)
	n = n % (b - c) + c
print(s + n // a)


def f(n, a, b, c):
	if a <= b - c:
		return n // a
	ans = 0
	while n >= b:
		t = max((n - b) // (b - c), 1)
		n -= (b - c) * t
		ans += t
	return ans + n // a
import sys
print(f(*map(int, sys.stdin.read().split())))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
q = max(0, 1 + (n - b) // (b - c))
ans = max(n // a, q + (n - q * (b - c)) // a)
print(str(ans))


def main():
	(n, a, b, c) = [int(input()) for _ in range(4)]
	if n < a and n < b:
		print(0)
	elif a <= b - c:
		print(n // a)
	else:
		if b > n:
			ng = 0
		else:
			ng = (n - c) // (b - c)
		np = (n - ng * (b - c)) // a
		print(ng + np)
main()


(n, a, b, c) = [int(input()) for _ in '1234']
r = 0
if b - c < a:
	r = n // (b - c) - b // (b - c)
	if r < 0:
		r = 0
	n -= r * (b - c)
	while b <= n:
		t = n // b
		r += t
		n = n % b + t * c
print(r + n // a)


summa = int(input())
plastic = int(input())
glass = int(input())
cash_back = int(input())
total = 0
need_to_return = 0
if plastic <= summa or glass <= summa:
	if plastic <= glass - cash_back or glass > summa:
		print(summa // plastic)
	elif summa >= glass:
		total = (summa - glass) // (glass - cash_back) + 1
		summa = summa - total * (glass - cash_back)
		if plastic <= summa:
			total = total + summa // plastic
			summa = summa - summa // plastic * plastic
		elif glass <= summa:
			total = total + summa // glass
		print(total)
else:
	print(0)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
if d < a:
	print(max((n - c) // d + (c + (n - c) % d) // a, n // a, 0))
else:
	print(n // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n < b or a < b - c:
	ans = n // a
elif a < b:
	ans = (n - c) // (b - c) + (n - (n - c) // (b - c) * (b - c)) // a
else:
	ans = (n - b) // (b - c) + 1
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
litr = 0
cen = b - c
if n >= a or n >= b:
	if cen < a and n >= c:
		litr = (n - c) // (b - c)
		n -= litr * (b - c)
litr += n // a
print(litr)


(n, a, b, c) = [int(input()) for i in range(4)]
ans = 0
if a <= b - c:
	ans = n // a
else:
	if n >= b:
		ans = (n - b) // (b - c)
		n = (n - b) % (b - c) + b
		n -= b - c
		ans += 1
	if a < b:
		ans += n // a
print(ans)


from sys import stdin, stdout
from math import ceil
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
PI = float('inf')
for _ in range(1):
	n = nmbr()
	p = nmbr()
	g = nmbr()
	r = nmbr()
	ans = 0
	eff_loss = g - r
	times = (n - g) // eff_loss
	if n - times * eff_loss >= g:
		times += 1
	if n >= g:
		ans = times
	left = n - ans * eff_loss
	ans += left // p
	ans1 = n // p
	print(max(ans, ans1))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
cnt = 0
if b - c < a and n >= b:
	cnt += (n - c) // (b - c)
	n -= cnt * (b - c)
	if n >= a:
		cnt += n // a
else:
	cnt += n // a
print(cnt)


from math import factorial as fact

def gcd(a, b):
	while a != 0:
		(a, b) = (b % a, a)
	return b

def lcm(a, b):
	return a * b // gcd(a, b)

def popcount(x):
	r = 0
	while x > 0:
		r += 1
		x &= x - 1
	return r

def bit(m, i):
	return m >> i & 1

def cnk(n, k):
	r = 1
	for i in range(n - k + 1, n + 1):
		r *= i
	return r // fact(k)
n = int(input())
a = int(input())
b = int(input())
c = int(input())
assert b > c
ans = 0
ans = max(ans, n // a)
if n >= b:
	k = 1 + (n - b) // (b - c)
	ans = max(ans, k)
	ans = max(ans, 1 + (n - b) // a)
	ans = max(ans, k + (n - k * (b - c)) // a)
print(ans)


N = int(input())
a = int(input())
b = int(input())
c = int(input())
solution = 0
if a >= b - c:
	if N >= b:
		solution = (N - b) // (b - c) + 1
	solution += (N - solution * (b - c)) // a
else:
	solution = N // a
print(solution)


import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
g = max(0, (n - c) // (b - c))
print(max(n // a, g + (n - g * (b - c)) // a))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c < a:
	u = max(n - b, 0) // (b - c) + (n >= b)
	v = max(n - u * (b - c), 0) // a
else:
	u = n // a
	v = max(n - u * a - b, 0) // (b - c) + (n - u * a >= b)
print(u + v)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n >= b:
	if a <= b - c:
		print(n // a)
	else:
		e = (n - c) // (b - c)
		left = n - (b - c) * e
		e += left // a
		print(e)
elif n >= a:
	print(n // a)
else:
	print(0)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def update(bit, i):
	while i < len(bit):
		bit[i] += 1
		i += i & -i

def getsum(bit, i):
	res = 0
	while i > 0:
		res += bit[i]
		i -= i & -i
	return res
import math
for _ in range(1):
	n = int(input())
	a = int(input())
	b = int(input())
	c = int(input())
	val = n % a
	ans = n // a
	ans1 = 0
	if val >= b:
		cnt = (val - b) // (b - c)
		ans += cnt + 1
	if n >= b:
		ans1 = (n - b) // (b - c)
		ans1 += 1
	ans1 += (n - ans1 * (b - c)) // a
	print(max(ans, ans1))


(n, a, b, c) = [int(input()) for _ in range(4)]
use = max(0, (n - b) // (b - c))
rem = n - use * (b - c)
x = rem // b
ans = max(n // a, use + max(rem // a, x + (rem - x * b + c * x) // a))
print(ans)


readInts = lambda : map(int, input().split())
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c or b > n:
	print(n // a)
else:
	tot = n - b
	cost = b - c
	ret = tot // cost + 1 + (tot % cost + c) // a
	print(ret)


import time
n = int(input())
a = int(input())
b = int(input())
c = int(input())
_b = int(b)
b -= c
second = 0
if n >= _b:
	second = (n - _b) // b + max(1 + ((n - _b) % b + c) // a, ((n - _b) % b + _b) // a)
print(max(n // a, second))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
count = 0
while n >= a or n >= b:
	if b - c < a and n // b > 0:
		count = count + (n - c) // (b - c)
		n = n - (n - c) // (b - c) * (b - c)
	else:
		count = count + n // a
		n = n - n // a * a
print(count)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
z = 0
if b - c < a and n > c:
	z = (n - c) // (b - c)
	n -= z * (b - c)
z += n // a
print(z)


__author__ = 'Admin'
n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if b - c < a and b <= n:
	ans = (n - c) // (b - c)
	if n - ans * (b - c) >= a:
		ans += (n - ans * (b - c)) // a
else:
	ans = n // a
if ans < 0:
	ans = 0
print(ans)


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	n = int(input())
	a = int(input())
	b = int(input())
	c = int(input())
	na = 0
	nb = 0
	if n >= a:
		na = n // a
	if n >= b:
		nb = (n - c) // (b - c)
		nb += ((n - c) % (b - c) + c) // a
	print(max(na, nb))

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


import collections
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if b - c < a:
	if b < n:
		ans += (n - b) // (b - c)
		n = b + (n - b) % (b - c)
	if b <= n:
		ans += n // b
		n = n % b + n // b * c
ans += n // a
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c > a:
	print(n // a)
	exit(0)
r = n % (b - c)
k = (b - r - 1) // (b - c)
m = n // (b - c)
if m < k:
	print(n // a)
	exit(0)
n -= (m - k) * (b - c)
print(m - k + n // a)


import math
import time
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import PriorityQueue
import sys
n = int(stdin.readline())
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
if a <= b - c:
	ans = n // a
	n = n % a
	while n >= b:
		ans += 1
		n -= b
		n += c
	print(max(ans, 0))
else:
	ec = b - c
	ans = 0
	if n >= b:
		ans = (n - b) // ec
		temp = (n - b) % ec
		n = b + temp
		while n >= b:
			ans += 1
			n -= b
			n += c
	ans += n // a
	print(max(ans, 0))


import sys

def solve(n, a, b, c):
	d = b - c
	num = max(0, (n - b) // d + 1)
	rest = n - num * d
	tmp = num + rest // a
	ret = max(n // a, tmp)
	print(ret)
	return ret

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	n = int(next(tokens))
	a = int(next(tokens))
	b = int(next(tokens))
	c = int(next(tokens))
	ret = solve(n, a, b, c)
main()


from math import ceil
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a < b - c:
	dec = a
	fin = a
	elfin = b
	eldec = b - c
else:
	dec = b - c
	fin = b
	elfin = a
	eldec = a
l = 0
r = 1000000000000000000000
while l != r - 1:
	c = (r + l) // 2
	if n - c * dec < fin:
		r = c
	else:
		l = c
if n - l * dec >= fin:
	plus = 1
else:
	plus = 0
count = l + plus
n -= (l + plus) * dec
l = 0
r = 1000000000000000000
while l != r - 1:
	c = (r + l) // 2
	if n - c * eldec < elfin:
		r = c
	else:
		l = c
if n - l * eldec >= elfin:
	plus = 1
else:
	plus = 0
count += l + plus
print(count)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
count = 0
if a <= d or (a <= n and b > n):
	count = n // a
elif n >= b:
	(count, _) = divmod(n - c, d)
	count += (n - count * d) // a
print(count)


II = lambda : int(input())
(n, a, b, c) = (II() for _ in range(4))
if a <= b - c:
	glass = 0
	plastic = n // a
else:
	glass = max((n - b) // (b - c) + 1, 0)
	rem = glass * (b - c)
	plastic = (n - rem) // a
print(max(glass + plastic, 0))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c:
	print(n // a)
else:
	l = (n - c) // (b - c) * (b - c)
	if l <= 0:
		print(n // a)
	else:
		print(l // (b - c) + (n - l) // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if b - c < a and n > c:
	ans += (n - c) // (b - c)
	n -= ans * (b - c)
ans += n // a
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c >= a or n < c:
	print(n // a)
else:
	x = (n - c) // (b - c)
	n = n - x * (b - c)
	x = x + n // a
	print(x)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
ans = max((n - c) // d, 0)
res = max(0, max(n // a, (n - d * ans) // a + ans))
print(res)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
s = 0
if n < min(a, b):
	print(0)
elif a <= b - c:
	print(n // a)
else:
	if n >= b:
		s = (n - b) // (b - c)
		n -= s * (b - c)
	while n >= b:
		n -= b - c
		s += 1
	s += n // a
	print(s)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
n1 = 0
if b - c < a:
	if n - b >= 0:
		n1 = (n - b) // (b - c)
		n1 += 1
		n -= n1 * (b - c)
	n1 += n // a
	print(n1)
else:
	n1 = n // a
	n -= n1 * a
	if n - b >= 0:
		n1 += (n - b) // (b - c)
		n1 += 1
	print(n1)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n < a and n < b:
	print(0)
elif n < b:
	print(n // a)
else:
	x1 = n // a
	x2 = (n - c) // (b - c)
	y = x2 * (b - c)
	x2 += (n - y) // a
	print(max(x1, x2))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
res = 0
if b - c < a and n > c:
	res = (n - c) // (b - c)
	n -= res * (b - c)
res += n // a
print(res)


I = lambda : int(input())
(n, a, b, c) = (I(), I(), I(), I())
(d, l) = (b - c, max(n - c, 0))
print(max(l // d + (l % d + c * (n >= b)) // a, n // a + max(0, n % a - c) // d))


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
a = INT()
b = INT()
c = INT()
cost = b - c
ans = 0
if a <= b - c:
	ans = n // a
	print(ans)
	exit(0)
r1 = (n - c) // cost
if r1 < 0:
	r1 = 0
x = n + r1 * c - r1 * b
r1 += x // a
print(max(r1, 0))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
r = n // a
if n > c:
	r = max(r, (r - b + c) // a + 1, (n - c) // (b - c) + ((n - c) % (b - c) + c) // a)
print(r)


s = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
l = 0
if d < a:
	if s >= b:
		l = (s - b) // d + 1
		s -= l * d
else:
	l = s // a
	s -= l * a
m = min(a, b)
if s >= m:
	l += s // m
print(l)


n = int(input())
cp = int(input())
cg = int(input())
pg = int(input())
if cp > n and cg > n:
	print('0')
elif cp <= cg - pg or cg > n:
	print(n // cp)
elif (n - cg + 1) % (cg - pg) and cg <= n:
	ans = (n - cg + 1) // (cg - pg) + 1
	n -= ((n - cg + 1) // (cg - pg) + 1) * (cg - pg)
	if n >= cp:
		ans += n // cp
	print(ans)
elif cg <= n:
	ans = (n - cg + 1) // (cg - pg)
	n = cg - 1
	if n >= cp:
		ans += n // cp
	print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
res = (n - b) // (b - c) + 1
if res >= 0:
	res += ((n - b) % (b - c) + c) // a
if res < n // a:
	res = n // a
print(res)


get = [int(input()) for i in range(4)]
(n, a, b, c) = get
cost = min(a, b - c)
if cost == a:
	ans = n // cost
else:
	ans = 0
	n = n - c
	if n > 0:
		ans = n // cost
		n -= ans * cost
	n += c
	ans += n // a
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if n >= b:
	if b - c >= a:
		print(n // a)
	else:
		answer = (n - b) // (b - c)
		n = b + (n - b) % (b - c)
		cnt = 1
		cnt = max(cnt + (n - b + c) // a, n // a)
		print(answer + cnt)
else:
	print(n // a)


n = int(input())
plastic = int(input())
glass = int(input())
empty = int(input())
first_ans = n // plastic
second_ans = 0
if n >= glass:
	second_ans = (n - glass) // (glass - empty)
	left = n - second_ans * (glass - empty)
	if left >= glass:
		left -= glass
		left += empty
		second_ans += 1
	second_ans += left // plastic
print(max(first_ans, second_ans))


(N, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
ans = 0
if b - c < a and N >= b:
	ans += (N - b) // (b - c) + 1
	N = (N - b) % (b - c) + c
print(ans + N // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = 0
e = -1
if n >= b:
	d = (n - b) // (b - c)
	e = ((n - b) % (b - c) + c) // a
print(max(d + e + 1, n // a, 0))


(n, a, b, c) = (int(input()), int(input()), int(input()), int(input()))

def solve(i, a, b, c):
	if i < b or a <= b - c:
		return i // a
	if i == b:
		return max(1, i // a)
	k = (i - b) // (b - c) + 1
	i -= k * (b - c)
	return k + solve(i, a, b, c)
print(solve(n, a, b, c))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = b - c
ansa = n // a
ans = 0
if n >= b:
	x = (n - b) // d + 1
	ans += x
	n -= d * x
	ans += n // a
print(max(ansa, ans, 0))


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a <= b - c or n < b:
	print(n // a)
else:
	dec = b - c
	diff = n - (b - 1)
	turns = diff // dec
	if diff % dec != 0:
		turns += 1
	n -= dec * turns
	print(turns + n // a)


def solve(n, a, b, c):
	if b - c >= a:
		return n // a
	if n < b:
		return n // a
	g = (n - b) // (b - c) + 1
	p = (n - g * (b - c)) // a
	return g + p
N = int(input())
A = int(input())
B = int(input())
C = int(input())
result = solve(N, A, B, C)
print(result)


(n, a, b, c) = [int(input()) for _ in range(4)]
if a <= b - c:
	print(n // a)
else:
	cnt = max(0, n - c) // (b - c)
	print(cnt + (n - cnt * (b - c)) // a)


import sys
n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c < a:
	temp = (n - b) // (b - c)
	temp += (n - temp * (b - c)) // b
	if temp < 0:
		temp = 0
	print((n - temp * (b - c)) // a + temp)
else:
	print(n // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if a > b - c:
	x = (n - b) // (b - c)
	if x < 0:
		x = n // a
		print(x)
	else:
		n -= (x + 1) * (b - c)
		x += 1
		x += n // a
		print(x)
else:
	x = n // a
	print(x)


(n, a, b, c) = [int(input()) for _ in range(4)]
p = n // a
d = max(-((-n + b - 1) // (b - c)), 0)
q = d + (n - (b - c) * d) // a
print(max(p, q))


(n, a, b, c) = [int(input()) for i in range(4)]
(ans1, ans2) = [0] * 2
if n >= b:
	num = (n - c) // (b - c)
	ans2 = num + (n - num * (b - c)) // a
if n >= a:
	ans1 = n // a
print(max(ans1, ans2))


def read_int():
	return int(input().split()[0])
totalMoney = read_int()
costPlastic = read_int()
costGlass = read_int()
costGlassReturn = read_int()
costGlassWithRet = costGlass - costGlassReturn
if totalMoney < costPlastic and totalMoney < costGlass:
	print(0)
elif costPlastic <= costGlassWithRet or costGlass > totalMoney:
	print(totalMoney // costPlastic)
else:
	result = 0
	if costGlass <= totalMoney:
		result += 1
	v1 = (totalMoney - costGlass) // costGlassWithRet
	v2 = (totalMoney - costGlass) % costGlassWithRet
	v3 = v2 + costGlassReturn
	if v3 >= costGlass:
		result += 1
		v3 -= costGlassWithRet
	result += v3 // costPlastic
	result += v1
	print(result)


n = eval(input())
a = eval(input())
b = eval(input())
c = eval(input())
x = 0
if b - c < a and n > c:
	x = (n - c) // (b - c)
	n -= x * (b - c)
x += n // a
print(x)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
if b - c < a and n >= b:
	count_gb = (n - b) // (b - c) + 1
	count_ga = (n - count_gb * (b - c)) // a
	print(count_gb + count_ga)
else:
	print(n // a)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
ans = 0
if a <= b - c or n < b:
	ans = n // a
else:
	ans = (n - c) // (b - c)
	rem = c + (n - c) - (b - c) * ans
	while rem >= b:
		rem = rem - (b - c)
		ans += 1
	if rem >= a:
		ans += rem // a
print(ans)


(n, a, b, c) = (int(input()), int(input()), int(input()), int(input()))
if a <= b - c:
	print(n // a)
else:
	bb = max(((n - b) // (b - c), -1)) + 1
	ans = (n - bb * (b - c)) // min((a, b)) + bb
	print(ans if ans > 0 else 0)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
n1 = n
if a <= b - c:
	ans = n // a
else:
	count = (n - c) // (b - c)
	n -= (b - c) * count
	ans = count + n // a
print(max(ans, 0, n1 // a))