def main(): n, m, p, q = map(int, input().split()) p -= 1 arr = [m] * 12 for i in range(q): arr[p + i] *= 2 res = 0 while n > 0: n -= arr[res % 12] res += 1 print(res) if __name__ == "__main__": main()